删除“gcc - / usr / bin / ld:warning lib not found” [英] Get rid of "gcc - /usr/bin/ld: warning lib not found"

查看:441
本文介绍了删除“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)

设置环境变量LD_LIBRARY_PATH = path_to_libxxx.so.6默认警告(添加-Lpath_to_libxxx.so.6没有帮助)。

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

单独的编译服务器,其中生成的二进制只编译。
二进制文件在其他服务器上执行,并且二进制文件可以看到libxxx.so.6(用 ldd executable 检查)。

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)?

推荐答案

您需要添加等效于 -L 的动态库:

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

-Wl,-rpath-link,/path/to/lib

这会导致链接器在非标准位置查找共享库,但只是为了验证链接是否正确。

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:

-Wl,-rpath,/path/to/lib

但是,罚款没有这个,那么你不需要它。

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

这篇关于删除“gcc - / usr / bin / ld:warning lib not found”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆