undefined reference to symbol 'pthread_key_delete@@GLIBC_2.2.5

imolital picture imolital · Sep 2, 2014 · Viewed 23.1k times · Source

I'm trying to make a file in Ubuntu and when i make i keep getting this error:

/usr/bin/ld: ../../gtest-1.7.0/libgtest.a(gtest-all.cc.o): undefined reference to symbol     'pthread_key_delete@@GLIBC_2.2.5'
/lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [src/tests/run_tests] Error 1
make[1]: *** [src/tests/CMakeFiles/run_tests.dir/all] Error 2
make: *** [all] Error 2

I saw someone mentioning to go into Makefile and adding '-L /lib64 -l pthread' to the variable LDFLAGS but how do you do that? Totally new to linux here =X

Answer

user4587644 picture user4587644 · Feb 20, 2015

The above linking problem is solved by adding

-lpthread -lm to CMakeLists.txt (target link libraries for luxrender);
TARGET_LINK_LIBRARIES(... -lpthread -lm)