【发布时间】:2016-02-05 09:07:06
【问题描述】:
我一直在为这个概念苦苦挣扎,我无法真正理解 -change 和 -id 之间的区别。手册页状态
-id name
Changes the shared library identification name of a dynamic shared library to name. If the Mach-O binary is not a dynamic
shared library and the -id option is specified it is ignored.
-change old new
Changes the dependent shared library install name old to new in the specified Mach-O binary. More than one of these options
can be specified. If the Mach-O binary does not contain the old install name in a specified -change option the option is
ignored.
到目前为止,我已经尝试过-change。假设我有以下结构
Test.App
|_Contents
|_MacOS
| |_test -----> item A
|_Library
|_test_library.dylib --->item B
|_another_library.dylib --->item C
现在假设我在 itemB 上运行了以下内容
$ otool -L test_library.dylib
test_library.dylib
/some/path/another_library.dylib -->item D
上面的结果表明test_library.dylib现在依赖another_library.dylib如果我需要改变another_library.dylib的位置我会这样做
install_name_tool -change /some/path/another_library.dylib some/new/path/another_library.dylib test_library.dylib
这会改变 D 项的位置。我的问题是 install-name_tool -id 做什么以及何时使用它?
【问题讨论】:
标签: xcode macos otool install-name-tool