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

前端 未结 14 1302
长情又很酷
长情又很酷 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:02

    What I have found is that sometimes the library that the linker complains about is not the one causing the problem. Possibly there is a clever way to work out where the problem is but this is what I do:

    • Comment out all the linked libraries in the link command.
    • Clean out all .o's, .so's etc (Usually make clean is enough, but you may want to run a recursive find + rm, or something similar).
    • Uncomment the libraries in the link command one at a time and re-arrange the order as necessary.

    @peter karasev: I have come across the same problem with a gcc 4.8.2 cmake project on CentOS7. The order of the libraries in "target_link_libraries" section is important. I guess cmake just passes the list on to the linker as-is, i.e. it doesn't try and work out the correct order. This is reasonable - when you think about it cmake can't know what the correct order is until the linking is successfully completed.

提交回复
热议问题