(newbie) boost thread compile problems on Fedora 8

Hi, I am having trouble compiling a correct version of the boost thread library on a x86_64 Fedora Core 8 and was wondering if anyone can help me out. I've tried both version 1.37 and 1.39. I describe below what I do and what happens after that. I am on an AMD64 Fedora Core 8 platform (with gcc 4.1.2 and glibc 2.7) that already had boost 1.34 on it at /usr/lib level. I erased that version by deleting all the libraries and moving 'boost' directory in /usr/include to 'boost_1-34' directory. I download the .gz tarball, bootstrap it, make it (with make for 1.37 and bjam for 1.39) and install it to /usr/local/lib. The compilation goes without a hitch (except for some warnings for boost serialization and others, but not for thread). I have both .a and .so files generated and residing in /usr/local/lib and boost include files in /usr/local/include. I add the links libboost_thread-mt.a and libboost_thread-mt.so to point to libboost_thread-gcc41-mt_1.3x.* libs. Now, I write a small test program (given below). It gives me linker errors with undefined references to pretty much every pthread symbol. If anyone wants I can paste all the errors in the next message. When I add the -lpthread flag to the compile, it gives me an undefined reference error with regards to __vdso_clock_gettime from /lib64/libpthread.a. I'm not sure where exactly the problem lies and would greatly appreciate if someone could point me in the right direction. Thank you. regards, Kishalay My test program: compiled with: gcc -o testk test.cpp -lboost_thread-mt #include <cstdio> #include <cstdlib> #include <boost/thread.hpp> using namespace std; using namespace boost; static void somefunc( ) { printf( "thread calling this\n" ); } int main( int argc, char** argv ) { boost::thread* t = new thread( somefunc ); delete t; }

Now, I write a small test program (given below). It gives me linker errors with undefined references to pretty much every pthread symbol.
Yes, boost::thread uses pthreads so you'll need to link against it.
If anyone wants I can paste all the errors in the next message. When I add the -lpthread flag to the compile, it gives me an undefined reference error with regards to __vdso_clock_gettime from /lib64/libpthread.a.
Looks like a known bug: http://sourceware.org/bugzilla/show_bug.cgi?id=5531 Chris -- echo mailto: NOSPAM !#$.'<*>'|sed 's. ..'|tr "<*> !#:2" org@fr33z3

The __vdso_clock_gettime problem seems to exist in the .a version. It doesn't show up when I build a shared library (libxfem.so) that is then loaded on runtime by a driver. This shared library has a class that contains boost threads. The error occurs when I construct a local thread (code snippet below). I do not know what the etiquette for attaching code files on boost mailing list is, so I'm not attaching my codes. But if you wish, I can send you the code files. boost::thread st( &XFE_Scene::run, _scene ); // error occurs here _threads[ 0 ] = boost::move( st ); When I try to load libxfem.so at run time, this is the error that I get. /home/kish1/Projects/Ashwini2.0/trunk/Engine/SafeDriver/src/CoreManager.cpp@initialize,82: fatal error: could not open libxfem.so /home/kish1/Projects/lib/libxfem.so: undefined symbol: _ZTIN5boost6detail16thread_data_baseE I greatly appreciate if you can decipher what exactly the problem is. I have a version running on an Intel Mac that has boost 1.37 installed, and the same code runs perfectly. It was also ran properly on a previous Fedora Core 7 version. On Thu, Jul 16, 2009 at 9:35 AM, Christoph Gysin<christoph.gysin@fr33z3.org> wrote:
Now, I write a small test program (given below). It gives me linker errors with undefined references to pretty much every pthread symbol.
Yes, boost::thread uses pthreads so you'll need to link against it.
If anyone wants I can paste all the errors in the next message. When I add the -lpthread flag to the compile, it gives me an undefined reference error with regards to __vdso_clock_gettime from /lib64/libpthread.a.
Looks like a known bug: http://sourceware.org/bugzilla/show_bug.cgi?id=5531
Chris -- echo mailto: NOSPAM !#$.'<*>'|sed 's. ..'|tr "<*> !#:2" org@fr33z3 _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Kishalay Kundu wrote:
The __vdso_clock_gettime problem seems to exist in the .a version. It doesn't show up when I build a shared library (libxfem.so) that is then loaded on runtime by a driver. This shared library has a class that contains boost threads. The error occurs when I construct a local thread (code snippet below). I do not know what the etiquette for attaching code files on boost mailing list is, so I'm not attaching my codes. But if you wish, I can send you the code files.
boost::thread st( &XFE_Scene::run, _scene ); // error occurs here _threads[ 0 ] = boost::move( st );
When I try to load libxfem.so at run time, this is the error that I get.
/home/kish1/Projects/Ashwini2.0/trunk/Engine/SafeDriver/src/CoreManager.cpp@initialize,82: fatal error: could not open libxfem.so /home/kish1/Projects/lib/libxfem.so: undefined symbol: _ZTIN5boost6detail16thread_data_baseE
This can mean that either: 1. You libxfem.so does not actually link to Boost. 2. Or, at runtime, a different version of Boost libraries is getting picked up. Running ldd on /home/kish1/Projects/lib/libxfem.so might help. - Volodya

Solved. Running ldd proved a great help. Long story short, I have to change the links. So, instead of ln -s libboost_thread-gcc41-mt-1_39.so.1.39.0 libboost_thread-mt.so, I had to change the link to ln -s /full/path/to/libboost_thread-gcc41-mt-1_39.so.1.39.0 libboost_thread-mt.so and it works now. Thanks for all the help and advice On Thu, Jul 16, 2009 at 11:35 AM, Vladimir Prus<vladimir@codesourcery.com> wrote:
Kishalay Kundu wrote:
The __vdso_clock_gettime problem seems to exist in the .a version. It doesn't show up when I build a shared library (libxfem.so) that is then loaded on runtime by a driver. This shared library has a class that contains boost threads. The error occurs when I construct a local thread (code snippet below). I do not know what the etiquette for attaching code files on boost mailing list is, so I'm not attaching my codes. But if you wish, I can send you the code files.
boost::thread st( &XFE_Scene::run, _scene ); // error occurs here _threads[ 0 ] = boost::move( st );
When I try to load libxfem.so at run time, this is the error that I get.
/home/kish1/Projects/Ashwini2.0/trunk/Engine/SafeDriver/src/CoreManager.cpp@initialize,82: fatal error: could not open libxfem.so /home/kish1/Projects/lib/libxfem.so: undefined symbol: _ZTIN5boost6detail16thread_data_baseE
This can mean that either:
1. You libxfem.so does not actually link to Boost. 2. Or, at runtime, a different version of Boost libraries is getting picked up. Running ldd on /home/kish1/Projects/lib/libxfem.so might help.
- Volodya
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Christoph Gysin
-
Kishalay Kundu
-
Vladimir Prus