boost static linking with cmake not working with karmic as it did with jaunty

Bug #473883 reported by fantaz
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
boost (Ubuntu)
New
Undecided
Unassigned

Bug Description

Hi,
I'm using Karmic version x64, boost lib version 1.38
When building boost.thread project with flag Boost_USE_STATIC_LIBS ON, I get the errors listed below, while if I build them with
Boost_USE_STATIC_LIBS OFF, everything works fine. I mean not only builds, but it executes as it should.
Btw, the Karmic is fresh install (no upgrade). CMake, boost 1.38 and gcc are from ubuntu repos. Everything worked just fine with Jaunty (with boost 1.35 actually). Is this the boost problem, or something else?
To reproduce the above problem, just take any boost.thread tutorial and write CMakeLists.txt as described in boost docs.
best regards,
fantaz

Here are the error messages
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libboost_thread-mt.a(thread.o): In function `T.1030':
(.text+0x1b8): undefined reference to `pthread_key_create'
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libboost_thread-mt.a(thread.o): In function `boost::thread::detach()':
(.text+0x76d): undefined reference to `pthread_detach'
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libboost_thread-mt.a(thread.o): In function `thread_proxy':
(.text+0xbd0): undefined reference to `pthread_setspecific'
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libboost_thread-mt.a(thread.o): In function `thread_proxy':
(.text+0xbf5): undefined reference to `pthread_setspecific'
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libboost_thread-mt.a(thread.o): In function `boost::thread::start_thread()':
(.text+0xdf0): undefined reference to `pthread_create'
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libboost_thread-mt.a(thread.o): In function `boost::(anonymous namespace)::make_external_thread_data()':
(.text+0x1071): undefined reference to `pthread_setspecific'
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libboost_thread-mt.a(thread.o): In function `boost::thread::timed_join(boost::posix_time::ptime const&)':
(.text+0x1811): undefined reference to `pthread_join'
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libboost_thread-mt.a(thread.o): In function `boost::thread::join()':
(.text+0x1c69): undefined reference to `pthread_join'
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libboost_thread-mt.a(thread.o): In function `boost::detail::(anonymous namespace)::create_current_thread_tls_key()':
(.text+0x10b): undefined reference to `pthread_key_create'
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libboost_thread-mt.a(thread.o): In function `boost::detail::get_current_thread_data()':
(.text+0x224): undefined reference to `pthread_getspecific'
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libboost_thread-mt.a(thread.o): In function `boost::detail::set_current_thread_data(boost::detail::thread_data_base*)':
(.text+0x474): undefined reference to `pthread_setspecific'
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libboost_thread-mt.a(once.o): In function `boost::detail::get_once_per_thread_epoch()':
(.text+0xc): undefined reference to `pthread_once'
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libboost_thread-mt.a(once.o): In function `boost::detail::get_once_per_thread_epoch()':
(.text+0x17): undefined reference to `pthread_getspecific'
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libboost_thread-mt.a(once.o): In function `boost::detail::get_once_per_thread_epoch()':
(.text+0x42): undefined reference to `pthread_setspecific'
/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/libboost_thread-mt.a(once.o): In function `create_epoch_tss_key':
(.text+0x6b): undefined reference to `pthread_key_create'
collect2: ld returned 1 exit status
make[2]: *** [Console/console_claw] Error 1
make[1]: *** [Console/CMakeFiles/console_claw.dir/all] Error 2
make: *** [all] Error 2

Revision history for this message
Alex Berghage (aberghage) wrote :

I get the same on x86 Karmic. I've attached a sample which is nothing but a simple cpp calling boost::this_thread::sleep, and a CMakeLists.txt to build it. To reproduce the bug, edit CMakeLists.txt to disable the static libs flag, create a build directory, cmake .. && make, and try the executable, then enable the static libs flag, delete CMakeCache.txt and try to rebuild.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.