c++ - Failed to linking bost_thread on solaris studio -


i'm trying compile , run simple example of boost thread (see code below), when i'm trying run program "segmentation fault (core dumped)". compile dan run program in other environments, on these succeeded (os x, linux), problem in solaris. don't know happening, me figure out problem?

command compile it

-bash-3.00$ cc -m64 -l/export/home/ulcm/standalone/lib -lboost_thread -pthreads -dc7_q -d_reentrant -i/export/home/ulcm/standalone/include -o main main.cpp cc: warning: option -pthreads passed ld, if ld invoked, ignored otherwise  

when trying run

-bash-3.00$ ./main segmentation fault (core dumped) 

boost version

1.48.0 

mdb output

-bash-3.00$ mdb ./main ./core loading modules: [ ld.so.1 libc.so.1 ] > ::status debugging core file of main (64-bit) sgdev0 file: main initial argv: ./main threading model: multi-threaded status: process terminated sigsegv (segmentation fault) > > ::stack libc.so.1`memcpy+0x1880() libcstd.so.1`__1cdstdmbasic_string4ccn0alchar_traits4cc__n0ajallocator4cc___hreserve6ml_v_+0x3a() libstlport.so.1`__1cdstdg__copy4cpkcn0auback_insert_iterator4n0ambasic_string4ccn0alchar_traits4c    c__n0a jallocator4cc______cl_6fta3tbrkn0abarandom_access_iterator_tag_ptc_4_+0x40e() libstlport.so.1`__1cdstdo_init_timeinfo6frn0ak_time_info__v_+0x3c0() libstlport.so.1`__1cdstdm_locale_impltmake_classic_locale6f_p1_+0x472() libstlport.so.1`__1cdstdglocalen_s_initialize6f_v_+0xe() libstlport.so.1`__slip.init_a+0x10() libstlport.so.1`_init+0x6d() ld.so.1`call_init+0x10a() ld.so.1`setup+0xa5e() ld.so.1`_setup+0x2d0() ld.so.1`_rt_boot+0x6d() 0xfffffd7fffdffd18() > 

solaris version

-bash-3.00$ cat /etc/release                        solaris 10 10/08 s10x_u6wos_07b x86            copyright 2008 sun microsystems, inc.  rights reserved.                         use subject license terms.                             assembled 27 october 2008 

cc version

-bash-3.00$ cc -v cc: sun c++ 5.11 sunos_i386 2010/08/13 usage: cc [ options ] files.  use 'cc -flags' details 

base code

    #include <iostream>     #include <string>      #include <boost/thread.hpp>     #include <boost/thread/mutex.hpp>      using namespace std;      boost::mutex m;      unsigned long long counter = 0;      void funcmutex()     {         cout<<">> funcmutex()"<<endl;         (int = 0; < 5; i++)         {             m.lock();             ++counter;             cout<<">> counter:"<<counter<<endl;             m.unlock();         }     }      int main()     {         cout<<"hello world!!!!"<<endl;         // start funcmutex on thread.         boost::thread t1(&funcmutex);         boost::thread t2(&funcmutex);         // join threads.         t1.join();         t2.join();         cout<<"...end"<<endl;          return 0;     } 


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -