插件包中的 dylib @executable_path 路径问题

发布于 2024-08-18 18:14:17 字数 1427 浏览 5 评论 0原文

我正在开发一个插件包,例如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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文