dimba dimba - 1 year ago 68
Linux Question

Get rid of "gcc - /usr/bin/ld: warning lib not found"

I have the following warning during link:

/usr/bin/ld: warning: libxxx.so.6, needed by /a/b/c/libyyy.so, not found (try using -rpath or -rpath-link)

Setting environment variable LD_LIBRARY_PATH=path_to_libxxx.so.6 silence the warning (adding -Lpath_to_libxxx.so.6 doesn't help).

I have a separate compilation server, where the resulting binary is only compile.
The binary is executed on other server and there the libxxx.so.6 is seen by the binary (checked with
ldd executable

Is there're other way to get rid of the warning at compilation time (I have it several times and it's very annoying)?

ams ams
Answer Source

You need to add the dynamic library equivalent of -L:


This will cause the linker to look for shared libraries in non-standard places, but only for he purpose of verifying the link is correct.

If you want the program to find the library at that location at run-time, then there's a similar option to do that:


But, if your program runs fine without this then you don't need it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download