libpthread.so.0: error adding symbols: DSO missing from command line

libstdc++.so.6: error adding symbols: dso missing from command line
libdl.so.2: error adding symbols: dso missing from command line
libm so 6 error adding symbols: dso missing from command line
libopencv_imgcodecs.so.3.2: error adding symbols: dso missing from command line
libboost_system so error adding symbols: dso missing from command line
dso missing from command line opengl
lib64/libtinfo so 5 error adding symbols: dso missing from command line
error adding symbols: dso missing from command line collect2: error: ld returned 1 exit status

When I'm compiling openvswitch-1.5.0, I've encountered the following compile error:

 gcc -Wstrict-prototypes -Wall -Wno-sign-compare -Wpointer-arith
     -Wdeclaration-after-statement -Wformat-security -Wswitch-enum -Wunused-parameter -Wstrict-aliasing -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers -Wno-override-init  -g -O2 -export-dynamic ***-lpthread***  -o utilities/ovs-dpctl utilities/ovs-dpctl.o lib/libopenvswitch.a
 /home/jyyoo/src/dpdk/build/lib/librte_eal.a
 /home/jyyoo/src/dpdk/build/lib/libethdev.a
 /home/jyyoo/src/dpdk/build/lib/librte_cmdline.a
 /home/jyyoo/src/dpdk/build/lib/librte_hash.a
 /home/jyyoo/src/dpdk/build/lib/librte_lpm.a
 /home/jyyoo/src/dpdk/build/lib/librte_mbuf.a
 /home/jyyoo/src/dpdk/build/lib/librte_ring.a
 /home/jyyoo/src/dpdk/build/lib/librte_mempool.a
 /home/jyyoo/src/dpdk/build/lib/librte_malloc.a -lrt -lm 
     /usr/bin/ld: /home/jyyoo/src/dpdk/build/lib/librte_eal.a(eal.o): undefined reference
     to symbol 'pthread_create@@GLIBC_2.2.5'
     /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from 
     command line

If I try to see the symbols of libpthread, it looks fine.

$ readelf -s /lib/x86_64-linux-gnu/libpthread.so.0 | grep pthread_create
   199: 0000000000008220  2814 FUNC    GLOBAL DEFAULT   13 pthread_create@@GLIBC_2.2.5
   173: 0000000000008220  2814 FUNC    LOCAL  DEFAULT   13 __pthread_create_2_1
   462: 0000000000008220  2814 FUNC    GLOBAL DEFAULT   13 pthread_create@@GLIBC_2.2

Could you give any hints or pointers?

You should mention the library on the command line after the object files being compiled:

 gcc -Wstrict-prototypes -Wall -Wno-sign-compare -Wpointer-arith -Wdeclaration-after-statement -Wformat-security -Wswitch-enum -Wunused-parameter -Wstrict-aliasing -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers -Wno-override-init \
     -g -O2 -export-dynamic -o utilities/ovs-dpctl utilities/ovs-dpctl.o \
     lib/libopenvswitch.a \
     /home/jyyoo/src/dpdk/build/lib/librte_eal.a /home/jyyoo/src/dpdk/build/lib/libethdev.a /home/jyyoo/src/dpdk/build/lib/librte_cmdline.a /home/jyyoo/src/dpdk/build/lib/librte_hash.a /home/jyyoo/src/dpdk/build/lib/librte_lpm.a /home/jyyoo/src/dpdk/build/lib/librte_mbuf.a /home/jyyoo/src/dpdk/build/lib/librte_ring.a /home/jyyoo/src/dpdk/build/lib/librte_mempool.a /home/jyyoo/src/dpdk/build/lib/librte_malloc.a \
     -lrt -lm -lpthread 

Explanation: the linking is dependent on the order of modules. Symbols are first requested, and then linked in from a library that has them. So you have to specify modules that use libraries first, and libraries after them. Like this:

gcc x.o y.o z.o -la -lb -lc

Moreover, in case there's a circular dependency, you should specify the same library on the command line several times. So in case libb needs symbol from libc and libc needs symbol from libb, the command line should be:

gcc x.o y.o z.o -la -lb -lc -lb

DSO missing from command line, libpthread.so.0: error adding symbols: DSO missing from command line (13 answers) DSO here means Dynamic Shared Object; since the error message says it's missing That is, try adding -lpthread to your command line. Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question.Provide details and share your research! But avoid …. Asking for help, clarification, or responding to other answers.

The error message depends on distribution / compiler version:

Ubuntu Saucy:

/usr/bin/ld: /mnt/root/ffmpeg-2.1.1//libavformat/libavformat.a(http.o): undefined reference to symbol 'inflateInit2_'
/lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from command line

Ubuntu Raring: (more informative)

/usr/bin/ld: note: 'uncompress' is defined in DSO /lib/x86_64-linux-gnu/libz.so.1 so try adding it to the linker command line

Solution: You may be missing a library in your compilation steps, during the linking stage. In my case, I added '-lz' to makefile / GCC flags.

Background: DSO is a dynamic shared object or a shared library.

libpthread.so.0: error adding symbols: DSO missing from command , libpthread.so.0: error adding symbols: DSO missing from command line #30. Open. anthonysong opened this issue on Jun 5, 2018 · 4 comments. Open  Dismiss Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

make, Edit the lines as shown below in the makefile and it should compile: FLAGS = -L /​lib64 LIBS = -lusb-1.0 -l pthread. The DSO missing from command line message will be displayed when the linker does not find the required symbol with it's normal search but the symbol is available in one of the dependencies of a directly specified dynamic library. In the past the linker considered symbols in dependencies of specified languages to be available.

I found I had the same error. I was compiling a code with both lapack and blas. When I switched the order that the two libraries were called the error went away.

"LAPACK_LIB = -llapack -lblas" worked where "LAPACK_LIB = -lblas -llapack" gave the error described above.

Make error: DSO missing from command line, symbol 'XKeycodeToKeysym' /usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line collect2: error: ld  I ended up installing ibctl-3.2.1, which installed successfully. I then re-downloaded v3.2.2, and the installation went fine! I checked the Makefile after running configure, and -lm was part of LIBS:

Background

The DSO missing from command line message will be displayed when the linker does not find the required symbol with it's normal search but the symbol is available in one of the dependencies of a directly specified dynamic library.

In the past the linker considered symbols in dependencies of specified languages to be available. But that changed in some later version and now the linker enforces a more strict view of what is available. The message thus is intended to help with that transition.

What to do?

If you are the maintainer of the software

You should solve this problem by making sure that all libraries that are needed to satisfy the needed symbols are directly specified on the linker command line. Also keep in mind that order often matters.

If you are just trying to compile the software

As a workaround it's possible to switch back to the more permissive view of what symbols are available by using the option -Wl,--copy-dt-needed-entries.

Common ways to inject this into a build are to export LDFLAGS before running configure or similar like this:

export LDFLAGS="-Wl,--copy-dt-needed-entries"

Sometimes passing LDFLAGS="-Wl,--copy-dt-needed-entries" directly to make might also work.

Error adding symbols: DSO missing from command line, //usr/lib/x86_64-linux-gnu/libboost_system.so.1.58.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit  Added a missing -lpthread flag to one Makefile #26 Merged Sarcasm added a commit to Sarcasm/OpenNI2 that referenced this issue Oct 14, 2014

Compiling, //lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status Specifications like the version of the project, operating system, and hardware Ubuntu 16.04 Steps to reproduce the problem I could compile and use OpenMVS both in Debug and Release mode, but recent

[SOLVED] Weird behavior with linker , to symbol 'pthread_create@@GLIBC_2.2.5' /lib64/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld  Welcome to LinuxQuestions.org, a friendly and active Linux Community. You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features.

error adding symbols: DSO missing from command line, //lib/arm-linux-gnueabihf/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status IMO, the "DSO missing from command line" is a separate error, where you'll need pthread. It would appear boost_system is possibly out of order for how it's required. Have you looked at the link order? Try adding boost_system before the others?

Comments
  • Also see Strange linking error: DSO missing from command line, DSO missing from command line, and Linking error: DSO missing from command line.
  • link_libraries(pthread)
  • # readelf -s /lib/x86_64-linux-gnu/libncurses.so readelf: Error: Could not locate '/lib/x86_64-linux-gnu/libncurses.so'. System error message: Too many levels of symbolic links
  • Possible duplicate of DSO missing from command line
  • Goddamnit, I did gcc not g++
  • I think you can do -Wl,--start-group -la -lb- -lc -Wl,--end-group for circular dependencies.
  • Note this also applies to source files--they should be listed before libraries. You can think of the resulting object files taking the place of the source files in the command line, and apply the same order as above.
  • Where should one add -lpthread when using make to build the application?
  • I used this solution building another project that was giving the same error by adding -lz to the LDFLAGS and it worked perfectly. Thanks!
  • The error still remain for me: /usr/bin/ld: gaSim.o: undefined reference to symbol 'pthread_create@@GLIBC_2.1' /lib/i386-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
  • In part solved adding '-lpthread', but now it shows me: gaSim.c:(.text+0x11d6): undefined reference to `glewInit'