如何设置二进制文件的RunPath? [英] How to set RunPath of a binary?

查看:270
本文介绍了如何设置二进制文件的RunPath?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有无数个线程描述什么是 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值



http://blog.tremily.us/posts/rpath /



这个链接似乎暗示了rpath和runpath的使用差异似乎是它们在搜索列表中的顺序:



http://en.wikipedia.org/wiki/Rpath

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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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