Question

[Solved] Undefined reference to symbol ‘[email protected]@GLIBC_2.2.5’

I just pulled a git repository in which me and my friends are developing an application. When I am running make I am facing this error:

undefined reference to symbol ‘[email protected]@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
Makefile:182: recipe for target ‘bin/release/ns’ failed make[1]: *
[bin/release/ns] Error 1 Makefile:133: recipe for target ‘release’
failed make: *
[release] Error 2

my friend pulled the same branch and he runs it without any problem.

Could you please give me some hints about the fix?

Detailed answer would be highly appreciated.

Solution #1:

I’ve been working on a multi-platform game engine and I faced same issue only on Linux. If you are using cmake add following to your cmake file:

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")

If you are not using cmake you need to add this flag for your compiler manually.

The complete cmake for using threads in linux systems must contain following commands:

      set(CMAKE_THREAD_LIBS_INIT "-lpthread")
      SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
      set(CMAKE_HAVE_THREADS_LIBRARY 1)
      set(CMAKE_USE_WIN32_THREADS_INIT 0)
      set(CMAKE_USE_PTHREADS_INIT 1)
      set(THREADS_PREFER_PTHREAD_FLAG ON)

Note: Also this fix works for Mac-Os but with one difference. You don’t need to pass -pthread as compiler flag

Respondent: Mohammad f
Solution #2:

You should add “-lpthread” to your library. Of cause, you should also add the directory of libpthread to your library directories.

Respondent: Y.Pengcheng
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy