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

前端 未结 14 864
长情又很酷
长情又很酷 2020-11-22 07:00

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

 gcc -Wstrict-prototypes -Wall -Wno-sign-compare -Wpointer-arith
     -         


        
相关标签:
14条回答
  • 2020-11-22 07:18

    if you are using cmake and used pthreads, try add the following lines

    find_package(Threads)
    target_link_libraries(${CMAKE_THREAD_LIBS_INIT})
    
    0 讨论(0)
  • 2020-11-22 07:18

    The same thing happened to me as I was installing the HPCC benchmark (includes HPL and a few other benchmarks). I added -lm to the compiler flags in my build script and then it successfully compiled.

    0 讨论(0)
  • 2020-11-22 07:21

    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.

    0 讨论(0)
  • 2020-11-22 07:21

    Try to add -pthread at the end of the library list in the Makefile.

    It worked for me.

    0 讨论(0)
  • 2020-11-22 07:22

    Please add: CFLAGS="-lrt" and LDFLAGS="-lrt"

    0 讨论(0)
  • 2020-11-22 07:23

    The same problem happened to me when I use distcc to make my c++ project; Finally I solved it with export CXX="distcc g++".

    0 讨论(0)
提交回复
热议问题