问题描述
有无数个线程描述什么是 RPATH
, RUNPATH
和 LD_LIBRARY_PATH
以及它们如何交互以解决库的位置。
设置 RPATH
使用gcc选项:
-Wl,-rpath,/ path / to / dir
设置LD_LIBRARY_PATH使用:
export LD_LIBRARY_PATH =< lib的路径>
我无法找到的是如何设置 RUNPATH
?
似乎如果您传递了--enable-new-dtags,runpath将设置为-Wl值
这个链接似乎暗示了rpath和runpath的使用差异似乎是它们在搜索列表中的顺序:
There are countless threads describing what is RPATH
, RUNPATH
and LD_LIBRARY_PATH
and how they interact in order to resolve libraries' location.
To set RPATH
use gcc options:
-Wl,-rpath,/path/to/dir
To set LD_LIBRARY_PATH use:
export LD_LIBRARY_PATH= <path of lib>
What I cannot find is how to set RUNPATH
?
Seems runpath is set to the -Wl value if you pass --enable-new-dtags
http://blog.tremily.us/posts/rpath/
This links seems to suggest the difference in use for rpath and runpath seems to be their order in the search list:
http://en.wikipedia.org/wiki/Rpath
这篇关于如何设置二进制文件的RunPath?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!