Having a problem with libpthread.so on Ubuntu

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

This project has some dependencies:

Libraries: FTGL (for fonts), FreeType2 (FTGL required), GLFW (for Windows and keyboard input), OpenGL. Software: CMake (if it is not created). But I have a problem with it.

And the installation guide looks like

To create and run:

cmake . make ./conv 

and I'm trying to build it.

 $ cmake . 

goes fine but when i try

 $ 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 was looking for this problem and I tried changing 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 has changed. I almost did not work a couple of hours, but I can not solve this problem, I still experience the same error. By the way

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

I suppose I don't need to change anything on this line?

PS I am using ubuntu 11.10 if that means anything :)

+6
source share
4 answers

try reconfiguring with pthread as shown below:

 $ CFLAGS='-lpthread' ./configure 
+8
source

On the TARGET_LINK_LIBRARIES command TARGET_LINK_LIBRARIES move pthread , so this is the last element. The GNU component requires that dependent libraries come before their dependencies.

You do not need to specify the absolute path to the pthread libraries that you are currently doing in CMAKE_CXX_FLAGS_DISTRIBUTION , and this limits the portability of the project.

+1
source

You need to reference X11 and pthread, I had this problem before with glfw.
-lX11 -lpthread

+1
source

Setting -L to the base file name will not solve any problems. If anything, you should install:

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

to include a directory with multiple arches. However, the compiler must do this on its own if you have an updated version of the compiler sent by Ubuntu.

0
source

Source: https://habr.com/ru/post/901913/


All Articles