我可以在已经编译的二进制文件中更改"rpath"吗? [英] Can I change 'rpath' in an already compiled binary?

查看:361
本文介绍了我可以在已经编译的二进制文件中更改"rpath"吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个计划用于废料堆的旧可执行文件,但是还不存在.它依赖于已经从我的环境中删除的一些库,但是我在某些可以正常工作的地方有一些存根库.我想将此可执行文件指向这些存根库.是的,我可以设置LD_LIBRARY_PATH,但是许多脚本都调用了该可执行文件,许多用户也希望将其修复在一处.

I have an old executable that's scheduled for the scrap heap, but it's not there yet. It relies on some libs that have been removed from my environment, but I have some stub libs someplace where it works fine. Id like to point this executable to these stub libs. Yes, i could set LD_LIBRARY_PATH, but this executable is called from many scripts, and many users and I'd love to fix it in one spot.

我没有这个来源,很难得到.我当时在想-我可以使用支持ELF的编辑器来编辑此文件,并向rpath添加一个简单的PATH使其进入新库吗?这有可能吗?或者一旦创建了ELF二进制文件,便将其固定在位置上而无法移动?

I don't have source for this, and would be hard to get it. I was thinking - can I edit this file, using an ELF aware editor, and add a simple PATH to rpath to have it hit the new libs? Is this possible, or once you create an ELF binary, you fix things to locations and they can't be moved?

推荐答案

有一个名为chrpath的工具可以执行此操作-您的发行版软件包中可能提供了该工具.

There is a tool called chrpath which can do this - it's probably available in your distribution's packages.

这篇关于我可以在已经编译的二进制文件中更改"rpath"吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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