在OSX上打印可执行文件的rpath [英] Print rpath of executable on OSX

查看:178
本文介绍了在OSX上打印可执行文件的rpath的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 install_name_tool 更改可执行文件的rpath,但我现在无法弄清楚rpath是什么。 install_name_tool 需要在命令行上提供旧的和新的rpath。

I want to change the rpath of an executable using install_name_tool, but I can't figure out what the rpath is right now. install_name_tool requires both the old and the new rpath's to be given on the commandline. What command can I use to print the rpath of an executable under OSX?

推荐答案

首先,我们可以使用一个可执行文件, t包含单个 rpath 条目,但包含一个或多个条目的数组。

First of all, understand that an executable doesn't contain a single rpath entry, but an array of one or more entries.

其次, code> otool 可列出图像的 rpath 条目。使用 otool -l <​​/ code>,你会得到如下输出,其中最后是 rpath

Second, you can use otool to list an image's rpath entries. Using otool -l, you'll get output like the following, at the very end of which are the rpath entries:

Load command 34
          cmd LC_LOAD_DYLIB
      cmdsize 88
         name /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (offset 24)
   time stamp 2 Wed Dec 31 19:00:02 1969
      current version 1038.32.0
compatibility version 45.0.0

Load command 35
          cmd LC_RPATH
      cmdsize 40
         path @loader_path/../Frameworks (offset 12)

查找 LC_RPATH 命令并记下 code>条目。

Look for the LC_RPATH commands and note the path under the path entry.

这篇关于在OSX上打印可执行文件的rpath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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