[SOLVED] undefined ref... 'pthread_getspecific@@GLIBC_2.

Okay, so for a start, hello everyone this my first post in the forums.

I’ve recently switched on Linux (Ubuntu) and successfully compiled P3D ( the engine developers shoudld really start considering CMake! Seriously now! ). So, I put some effort on understanding the engine by following the online tutorials.

After successfully compiling the first one (took some serious effort because the additional libraries required are not referenced anywhere in it… ), I’m trying to do the same with the second one too. However the whole thing starts getting really confusing and I’d really love some help here.
I’m using CodeBlocks and C++ scripting ( Not interested in using Python - at this stage at least ) and everything is fine until I type:


It is giving me the following error:

undefined reference to symbol 'pthread_getspecific@@GLIBC_2.

I have absolutely no idea what this is about. Tried google and the forums but still not getting anything helpful.

If it’s a duplicated question please accept my apologies.


I managed to solve the problem on my own after all:

In case anyone else is using codeblocks on Ubuntu make sure you go to Settings->Compiler->Linker Settings->Other Linker Options and type “-pthread”.
My god! What a mess! If I survive these tutorials I might find some time to make a codeblocks guide.

Hey JohnE.K., on my debian jessie this command builds successfully your second one test (which I put into second_one.cpp file):

g++ -I/usr/include/eigen3/ -I/usr/include/panda3d second_one.cpp -L/usr/lib/x86_64-linux-gnu/panda3d -lpanda -lpandaexpress -lp3dtoolconfig -lp3dtool -lpthread -lpython2.7 -lp3framework -o second_one

The real problem when building in c++, is to find the correct paths both for includes (-I) and libraries (-L) and the correct shared libraries to link to (-l). Often I use an iterative process to build and add missing paths and libraries.

Hey, thanks for the input Consultit!

Paths were okay in my case (I use a custom engine build and I keep all libraries and headers organized inside my own dirs for more control). The whole problem was caused by the he absence of “-pthread” from the linker on Code::Blocks and if I may say so the luck of a detailed version of the existed P3D documentation. The c++ tutorials should at least include references to required headers and libraries for newcomers.

In any case I’d love to see (and I believe many more developers - professionals or not) some support over a more human oriented way of using P3D. Starting with CMake and multiplatform IDE support.


I love CMake. We’d love to switch to it. We’ve been working on it.

Hey, that is great news @rdb! Can’t wait!