【发布时间】:2011-01-06 20:31:44
【问题描述】:
我正在开发一个插件包,例如MyPlugIn.bundle 用于应用程序,例如BigApp.app。 此捆绑包需要 dylib,例如 MyPlugIn.bundle/Contents/Resources/library.dylib。我已经为 library.dylib 重新定位了路径,就像我对一个简单的应用程序包所做的那样:
$ otool -L MyPlugIn.bundle/Contents/MacOS/MyPlugIn
MyPlugIn.bundle/Contents/MacOS/MyPlugIn:
@executable_path/../Resources/library.dylib (compatibility version 0.0.0, current version 0.0.0)
[...]
$ otool -L MyPlugIn.bundle/Contents/Resources/library.dylib
MyPlugIn.bundle/Contents/Resources/library.dylib:
@executable_path/../Resources/library.dylib (compatibility version 0.0.0, current version 0.0.0)
[...]
但 BigApp.app 无法加载此捆绑包,并且 Mac OS X 的 Console.app 会记录以下内容:
19/01/10 15:42:59 BigApp[51516] Error loading /Library/Application Support/BigApp/Plug-Ins/MyPlugIn.bundle/Contents/MacOS/MyPlugIn: dlopen(/Library/Application Support/BigApp/Plug-Ins/MyPlugIn.bundle/Contents/MacOS/MyPlugIn, 262): Library not loaded: @executable_path/../Resources/library.dylib
Referenced from: /Library/Application Support/BigApp/Plug-Ins/MyPlugIn.bundle/Contents/MacOS/MyPlugIn
Reason: image not found
看来@executable_path 不是被MyPlugIn.bundle 可执行路径替换,而是被BigApp.app 可执行路径。
任何解决方法,没有绝对路径,以便它可以在 Mac OS X 10.4 (Tiger) 上运行?谢谢。
【问题讨论】:
标签: xcode plugins dylib install-name-tool