插件包中的 dylib @executable_path 路径问题
我正在开发一个插件包,例如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< /strong> 不会替换为 MyPlugIn.bundle 可执行路径,而是替换为 BigApp.app 可执行路径。
任何解决方法,没有绝对路径,以便它可以在Mac OS X 10.4 (Tiger)上工作?谢谢。
I am developing a plug-in bundle, say MyPlugIn.bundle
for an application, say BigApp.app
. This bundle requires a dylib, say MyPlugIn.bundle/Contents/Resources/library.dylib
. I have relocated paths for library.dylib, as I would have done for a simple application bundle:
$ 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)
[...]
But BigApp.app fails to load this bundle, and Mac OS X's Console.app logs what follows:
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
It seems that @executable_path is not replaced by the MyPlugIn.bundle executable path but by the BigApp.app executable path.
Any workaround to that, without absolute path and so that it will work on Mac OS X 10.4 (Tiger)? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自网络和其他 SO 问题:使用
@loader_path/..
而不是@executable_path/..
。请参阅:From the web and other SO questions: use
@loader_path/..
instead of@executable_path/..
. See: