3

我的应用需要加载一个硬件制造商提供的 dylib。在 dylib 上使用 otool 会产生以下输出:

$otool -L harwdware.2.dylib 
hardware.2.dylib:
    @executable_path/../Addittional/hardware.2.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1153.18.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)

而且我想将@executable_path/../Addittional/更改为@executable_path/../Frameworks/这实际上更短,所以它应该适合。但是当我运行时:

install_name_tool -change @executable_path/../Addittional/hardware.2.dylib @executable_path/../Frameworks/hardware.2.dylib hardware.2.dylib

然后什么也没有发生,没有任何变化,otool 的输出与以前相同。

我哪里错了?

4

1 回答 1

4

感谢@trojanfoe,正确的命令行是:

install_name_tool -id "@executable_path/../Frameworks/hardware.2.dylib"  hardware.2.dylib
于 2015-09-11T13:57:46.613 回答