When I\'m compiling openvswitch-1.5.0, I\'ve encountered the following compile error:
gcc -Wstrict-prototypes -Wall -Wno-sign-compare -Wpointer-arith
-
if you are using cmake and used pthreads, try add the following lines
find_package(Threads)
target_link_libraries(${CMAKE_THREAD_LIBS_INIT})
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.
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.
Try to add -pthread
at the end of the library list in the Makefile.
It worked for me.
Please add: CFLAGS="-lrt"
and LDFLAGS="-lrt"
The same problem happened to me when I use distcc
to make my c++ project;
Finally I solved it with export CXX="distcc g++"
.