Having a libpthread.so linking trouble on Ubuntu

sergekondrat picture sergekondrat · Nov 20, 2011 · Viewed 14.9k times · Source

I've downloaded source code from this site http://mnbayazit.com/406/bayazit

This project has some dependencies:

Libraries: FTGL (for fonts), FreeType2 (needed by FTGL), GLFW (for windows and keyboard input), OpenGL. Software: CMake (if it doesn't build) But I'm having a problem with it.

And installation guide looks like

To build and run:

cmake .
make
./conv

and I am trying to build it.

$ cmake .  

goes just fine, but when I'm trying to

$ make

I get this error:

Linking CXX executable conv
/usr/bin/ld: /usr/local/lib/libglfw.a(x11_init.o): undefined reference to symbol 'pthread_kill@@GLIBC_2.0'
/usr/bin/ld: note: 'pthread_kill@@GLIBC_2.0' is defined in DSO /lib/i386-linux-gnu/libpthread.so.0 so try adding it to the linker command line
/lib/i386-linux-gnu/libpthread.so.0: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[2]: *** [conv] Error 1
make[1]: *** [CMakeFiles/conv.dir/all] Error 2
make: *** [all] Error 2

I googled this problem and I tried to change CMakeLists.txt by changing

SET(CMAKE_BUILD_TYPE distribution)
SET(CMAKE_CXX_FLAGS_DISTRIBUTION "-O3")

to

SET(CMAKE_BUILD_TYPE distribution)
SET(CMAKE_CXX_FLAGS_DISTRIBUTION "-O3 -L/usr/lib/i386-linux-gnu/lpthread")

But nothing changed. I googled hardly for a couple of hours, but I can't really solve the problem, I'm still having the same error. By the way,

TARGET_LINK_LIBRARIES(conv Xrandr pthread ftgl glfw ${OPENGL_LIBRARIES})

I suppose, I needn't change anything in this string?

P.S. I'm using ubuntu 11.10 if that means something :)

Answer

Marian Zagoruiko picture Marian Zagoruiko · Jun 10, 2013

try reconfiguring with pthread included like so:

$ CFLAGS='-lpthread' ./configure