[solved]BUG: Build fails on Debian GNU/Linux 5.0.6, pthreads

reptor
Posts: 17
Joined: Mon Jan 05, 2009 3:44 pm

[solved]BUG: Build fails on Debian GNU/Linux 5.0.6, pthreads

Post by reptor »

I've got the svn 2223 revision of bullet physics library.

A build started clean fails like this:
Scanning dependencies of target AppThreadingDemo
[ 98%] Building CXX object Demos/ThreadingDemo/CMakeFiles/AppThreadingDemo.dir/main.o
/home/dev/libs/bullet-trunk/Demos/ThreadingDemo/main.cpp: In function ‘btThreadSupportInterface* createThreadSupport(int)’:
/home/dev/libs/bullet-trunk/Demos/ThreadingDemo/main.cpp:38: warning: deprecated conversion from string constant to ‘char*’
Linking CXX executable AppThreadingDemo
../../src/BulletMultiThreaded/libBulletMultiThreaded.a(PosixThreadSupport.o): In function `PosixThreadSupport::sendRequest(unsigned int, unsigned int, unsigned int)':
PosixThreadSupport.cpp:(.text+0xce): undefined reference to `sem_post'
PosixThreadSupport.cpp:(.text+0xe4): undefined reference to `sem_post'
../../src/BulletMultiThreaded/libBulletMultiThreaded.a(PosixThreadSupport.o): In function `threadFunction(void*)':
PosixThreadSupport.cpp:(.text+0x154): undefined reference to `sem_post'
PosixThreadSupport.cpp:(.text+0x16b): undefined reference to `sem_wait'
PosixThreadSupport.cpp:(.text+0x181): undefined reference to `sem_wait'
PosixThreadSupport.cpp:(.text+0x1c0): undefined reference to `sem_post'
PosixThreadSupport.cpp:(.text+0x1d8): undefined reference to `sem_post'
PosixThreadSupport.cpp:(.text+0x238): undefined reference to `sem_post'
../../src/BulletMultiThreaded/libBulletMultiThreaded.a(PosixThreadSupport.o): In function `PosixThreadSupport::waitForResponse(unsigned int*, unsigned int*)':
PosixThreadSupport.cpp:(.text+0x285): undefined reference to `sem_wait'
PosixThreadSupport.cpp:(.text+0x2f8): undefined reference to `sem_wait'
../../src/BulletMultiThreaded/libBulletMultiThreaded.a(PosixThreadSupport.o): In function `PosixThreadSupport::stopSPU()':
PosixThreadSupport.cpp:(.text+0x369): undefined reference to `sem_wait'
PosixThreadSupport.cpp:(.text+0x388): undefined reference to `sem_destroy'
PosixThreadSupport.cpp:(.text+0x39b): undefined reference to `sem_destroy'
PosixThreadSupport.cpp:(.text+0x3de): undefined reference to `pthread_cancel'
PosixThreadSupport.cpp:(.text+0x437): undefined reference to `sem_post'
PosixThreadSupport.cpp:(.text+0x451): undefined reference to `sem_post'
PosixThreadSupport.cpp:(.text+0x490): undefined reference to `sem_wait'
PosixThreadSupport.cpp:(.text+0x4ce): undefined reference to `pthread_cancel'
PosixThreadSupport.cpp:(.text+0x516): undefined reference to `sem_destroy'
PosixThreadSupport.cpp:(.text+0x529): undefined reference to `sem_destroy'
../../src/BulletMultiThreaded/libBulletMultiThreaded.a(PosixThreadSupport.o): In function `PosixThreadSupport::startThreads(PosixThreadSupport::ThreadConstructionInfo&)':
PosixThreadSupport.cpp:(.text+0x7e5): undefined reference to `sem_init'
PosixThreadSupport.cpp:(.text+0x808): undefined reference to `sem_init'
PosixThreadSupport.cpp:(.text+0x8de): undefined reference to `sem_init'
PosixThreadSupport.cpp:(.text+0x904): undefined reference to `sem_init'
PosixThreadSupport.cpp:(.text+0x94d): undefined reference to `pthread_create'
PosixThreadSupport.cpp:(.text+0x97b): undefined reference to `pthread_create'
../../src/BulletMultiThreaded/libBulletMultiThreaded.a(PosixThreadSupport.o): In function `PosixBarrier::setMaxCount(int)':
PosixThreadSupport.cpp:(.text._ZN12PosixBarrier11setMaxCountEi[PosixBarrier::setMaxCount(int)]+0x25): undefined reference to `pthread_barrier_init'
../../src/BulletMultiThreaded/libBulletMultiThreaded.a(PosixThreadSupport.o): In function `PosixBarrier::sync()':
PosixThreadSupport.cpp:(.text._ZN12PosixBarrier4syncEv[PosixBarrier::sync()]+0x10): undefined reference to `pthread_barrier_wait'
../../src/BulletMultiThreaded/libBulletMultiThreaded.a(PosixThreadSupport.o): In function `PosixBarrier::~PosixBarrier()':
PosixThreadSupport.cpp:(.text._ZN12PosixBarrierD0Ev[PosixBarrier::~PosixBarrier()]+0x17): undefined reference to `pthread_barrier_destroy'
../../src/BulletMultiThreaded/libBulletMultiThreaded.a(PosixThreadSupport.o): In function `PosixBarrier::~PosixBarrier()':
PosixThreadSupport.cpp:(.text._ZN12PosixBarrierD1Ev[PosixBarrier::~PosixBarrier()]+0x17): undefined reference to `pthread_barrier_destroy'
collect2: ld returned 1 exit status
make[2]: *** [Demos/ThreadingDemo/AppThreadingDemo] Virhe 1
make[1]: *** [Demos/ThreadingDemo/CMakeFiles/AppThreadingDemo.dir/all] Virhe 2
make: *** [all] Virhe 2

I guess pthreads isn't linked in somewhere where it should be.

Pthreads is certainly present on the system as I use it elsewhere and bullet and its demos too seemed to build just fine some weeks/months ago so I think something changed in bullet which broke it.

I can get around this by disabling the demos and the libs seem to build fine.
Last edited by reptor on Mon Oct 11, 2010 5:05 pm, edited 1 time in total.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: BUG: Build fails on Debian GNU/Linux 5.0.6, pthreads

Post by Erwin Coumans »

Can you try the latest trunk, it should be fixed by now. See http://code.google.com/p/bullet/source/detail?r=2224

In a nutshell, ThreadingDemo was added to the build system for UNIX recently, and it requires pthreads.
Thanks,
Erwin
reptor
Posts: 17
Joined: Mon Jan 05, 2009 3:44 pm

Re: BUG: Build fails on Debian GNU/Linux 5.0.6, pthreads

Post by reptor »

Thanks, it works now.