我的应用需要加载硬件制造商提供的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的输出与之前相同。
我哪里错了?
答案 0 :(得分:1)
感谢@trojanfoe,正确的命令行是:
install_name_tool -id "@executable_path/../Frameworks/hardware.2.dylib" hardware.2.dylib