部署不同版本程序时比较有用的一个东西。mark一下。
chrpath 这个工具可以将写死的依赖去掉.
Usage: chrpath [-v|-d|-c|-r <path>] <program> [<program> ...] -v|--version Display program version number -d|--delete Delete current rpath/runpath setting -c|--convert Convert rpath to runpath -r <path>|--replace <path> Replace current rpath/runpath setting with the path given -l|--list List the current rpath/runpath (default) -h|--help Show this usage information.
=============================================
2017-03-16 更新
=============================================
################################# # Linux ################################# # 删除写死的rpath chrpath -d lib*.so* # 指定查找路径 LD_LIBRARY_PAT
######################## # MAC OS X ######################## install_name_tool old new dylib # old 是某依赖库的旧的绝对路径 # new 是某依赖库新的的绝对或相对路径. # 可以用(@executable_path, @loader_path 和 @rpath)
https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/dyld.1.html 写道
@executable_path/
This variable is replaced with the path to the directory containing the main executable for
the process. This is useful for loading dylibs/frameworks embedded in a .app directory. If
the main executable file is at /some/path/My.app/Contents/MacOS/My and a framework dylib file
is at /some/path/My.app/Contents/Frameworks/Foo.framework/Versions/A/Foo, then the framework
load path could be encoded as @executable_path/../Frameworks/Foo.framework/Versions/A/Foo and
the .app directory could be moved around in the file system and dyld will still be able to
load the embedded framework.
@loader_path/
This variable is replaced with the path to the directory containing the mach-o binary which
contains the load command using @loader_path. Thus, in every binary, @loader_path resolves to
a different path, whereas @executable_path always resolves to the same path. @loader_path is
useful as the load path for a framework/dylib embedded in a plug-in, if the final file system
location of the plugin-in unknown (so absolute paths cannot be used) or if the plug-in is used
by multiple applications (so @executable_path cannot be used). If the plug-in mach-o file is
at /some/path/Myfilter.plugin/Contents/MacOS/Myfilter and a framework dylib file is at
/some/path/Myfilter.plugin/Contents/Frameworks/Foo.framework/Versions/A/Foo, then the frame-work framework
work load path could be encoded as @loader_path/../Frameworks/Foo.framework/Versions/A/Foo and
the Myfilter.plugin directory could be moved around in the file system and dyld will still be
able to load the embedded framework.
@rpath/
Dyld maintains a current stack of paths called the run path list. When @rpath is encountered
it is substituted with each path in the run path list until a loadable dylib if found. The
run path stack is built from the LC_RPATH load commands in the depencency chain that lead to
the current dylib load. You can add an LC_RPATH load command to an image with the -rpath
option to ld(1). You can even add a LC_RPATH load command path that starts with
@loader_path/, and it will push a path on the run path stack that relative to the image con-taining containing
taining the LC_RPATH. The use of @rpath is most useful when you have a complex directory
structure of programs and dylibs which can be installed anywhere, but keep their relative
positions. This scenario could be implemented using @loader_path, but every client of a dylib
could need a different load path because its relative position in the file system is differ-ent. different.
ent. The use of @rpath introduces a level of indirection that simplies things. You pick a
location in your directory structure as an anchor point. Each dylib then gets an install path
that starts with @rpath and is the path to the dylib relative to the anchor point. Each main
executable is linked with -rpath @loader_path/zzz, where zzz is the path from the executable
to the anchor point. At runtime dyld sets it run path to be the anchor point, then each dylib
is found relative to the anchor point.
This variable is replaced with the path to the directory containing the main executable for
the process. This is useful for loading dylibs/frameworks embedded in a .app directory. If
the main executable file is at /some/path/My.app/Contents/MacOS/My and a framework dylib file
is at /some/path/My.app/Contents/Frameworks/Foo.framework/Versions/A/Foo, then the framework
load path could be encoded as @executable_path/../Frameworks/Foo.framework/Versions/A/Foo and
the .app directory could be moved around in the file system and dyld will still be able to
load the embedded framework.
@loader_path/
This variable is replaced with the path to the directory containing the mach-o binary which
contains the load command using @loader_path. Thus, in every binary, @loader_path resolves to
a different path, whereas @executable_path always resolves to the same path. @loader_path is
useful as the load path for a framework/dylib embedded in a plug-in, if the final file system
location of the plugin-in unknown (so absolute paths cannot be used) or if the plug-in is used
by multiple applications (so @executable_path cannot be used). If the plug-in mach-o file is
at /some/path/Myfilter.plugin/Contents/MacOS/Myfilter and a framework dylib file is at
/some/path/Myfilter.plugin/Contents/Frameworks/Foo.framework/Versions/A/Foo, then the frame-work framework
work load path could be encoded as @loader_path/../Frameworks/Foo.framework/Versions/A/Foo and
the Myfilter.plugin directory could be moved around in the file system and dyld will still be
able to load the embedded framework.
@rpath/
Dyld maintains a current stack of paths called the run path list. When @rpath is encountered
it is substituted with each path in the run path list until a loadable dylib if found. The
run path stack is built from the LC_RPATH load commands in the depencency chain that lead to
the current dylib load. You can add an LC_RPATH load command to an image with the -rpath
option to ld(1). You can even add a LC_RPATH load command path that starts with
@loader_path/, and it will push a path on the run path stack that relative to the image con-taining containing
taining the LC_RPATH. The use of @rpath is most useful when you have a complex directory
structure of programs and dylibs which can be installed anywhere, but keep their relative
positions. This scenario could be implemented using @loader_path, but every client of a dylib
could need a different load path because its relative position in the file system is differ-ent. different.
ent. The use of @rpath introduces a level of indirection that simplies things. You pick a
location in your directory structure as an anchor point. Each dylib then gets an install path
that starts with @rpath and is the path to the dylib relative to the anchor point. Each main
executable is linked with -rpath @loader_path/zzz, where zzz is the path from the executable
to the anchor point. At runtime dyld sets it run path to be the anchor point, then each dylib
is found relative to the anchor point.
相关推荐
`chrpath`是一个开源工具,主要用于查看和修改ELF(Executable and Linkable Format)文件中的运行路径(RPATH和RUNPATH)。在Linux和类UNIX系统中,这些路径用于定位程序运行时所需的动态链接库(DLLs或.so文件)。...
在Linux系统中,许多可执行文件和动态链接库依赖于特定的路径来找到它们所需的库文件。chrpath工具允许管理员或开发者在不重新编译的情况下调整这些依赖路径,这对于调试、打包或部署软件特别有用。 chrpath-0.13-7...
`chrpath`是一款小巧但实用的工具,主要用途是修改二进制文件中的RPATH或RUNPATH字段。在Linux和类Unix系统中,RPATH和RUNPATH是用来指示动态链接器在何处查找共享库的路径。了解`chrpath`及其工作原理对于系统管理...
离线安装包,亲测可用
chrpath-0.13-7.el6.i686.rpm是centos工具包。
离线安装包,亲测可用
离线安装包,亲测可用
- `chrpath`:修改程序的库搜索路径。 - `gawk`:一种文本处理语言。 - `texinfo`:文档系统。 - `diffstat`:比较文件差异。 - `binfmt-support`:支持二进制格式转换。 - `qemu-user-static`:QEMU用户态...
一个工具,可以: :deciduous_tree: 把ldd变成一棵树 :index_pointing_up: 解释为什么找到共享库,为什么找不到 :package: (可选)将可执行文件和依赖项部署到单个目录中 安装 从Github下载: wget ...
这时,可以使用软链接或者使用像是`chrpath`和`alternatives`这样的工具来管理多个GCC版本。 总的来说,GCC 4.8.5 RPM包是为RHEL 7系统提供了一个方便的、离线的安装选项,特别适合那些需要在该系统上编译代码的...
其中最重要的是OpenGL库,因为QtQuick模块需要OpenGL的支持来生成相关的库文件。 - **OpenGL库**:为了使Qt5能够正常运行,需要确保OpenGL库与目标机和内核版本相匹配。通常情况下,可以从官方网站或其他可靠来源...
$ sudo apt-get install build-essential chrpath coreutils cvs cvsnt desktop-file-utils diffstat docbook-utils fakeroot g++ gawk gcc git git-core help2man libgmp3-dev libmpfr-dev libreadline6-dev ...
如果在安装过程中遇到缺失的依赖库,按照提示使用 `apt install` 命令进行安装。 安装完毕后,你需要验证安装是否成功。运行以下命令,将 PetaLinux 环境变量添加到当前终端: ```bash source ~/petalinux2019/...
4. **YOCTO编译所需的主机包**:这些包是YOCTO项目的基本需求,可以通过`sudo apt-get install`命令安装,包括gawk、wget、git-core、diffstat、unzip、texinfo、gcc多架构支持、build-essential、chrpath、socat、...
官网wiki地址提供了相关依赖包的列表,包括acl、apt-utils、attr、autoconf、bind9utils、binutils、bison、build-essential、chrpath、curl、debhelper、dnsutils、docbook-xml、docbook-xsl、flex、gcc、gdb、git...
安装以下依赖项:颠覆chrpath fluid imagemagick xsltproc 在get_cross_env.sh设置ROOT envvar source get_cross_env.sh 运行make开始初始的OpenTom构建 可能还要等一下; 考虑给自己喝杯咖啡;-) 将build/...
要使***tor能够开发适用于树莓派的应用程序,需要为Linux工具链进行配置,以支持目标平台的特定编译选项和库文件。 九、Ubuntu16.04安装VirtualBox5.2版本 文档中提到的在Ubuntu 16.04中安装VirtualBox版本5.2是...
用户可以通过运行“sudo apt-get install”命令配合相应的包名来安装这些依赖包。 接下来,需要运行os-init-build-env环境设置脚本,在Linux机器上定义Yocto项目的构建环境。运行“oe-init-build-env”脚本将会定义...
离线安装包,亲测可用