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

xcode – dylib @executable_path插件包中的路径问题,第1张

概述我正在开发一个插件捆绑包,说应用程序的MyPlugIn.bundle,说BigApp.app.这个bundle需要一个dylib,说MyPlugIn.bundle / Contents / Resources / library.dylib.我已经为library.dylib重新定位了路径,就像我为一个简单的应用程序包所做的一样: $otool -L MyPlugIn.bundle/Content 我正在开发一个插件捆绑包,说应用程序的MyPlugIn.bundle,说BigApp.app.这个bundle需要一个dylib,说MyPlugIn.bundle / Contents / Resources / library.dylib.我已经为library.dylib重新定位了路径,就像我为一个简单的应用程序包所做的一样:
$otool -L MyPlugIn.bundle/Contents/MacOS/MyPlugInMyPlugIn.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.dylibMyPlugIn.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)上工作?谢谢.

解决方法 从网络和其他SO问题:使用@ loader_path / ..而不是@executable_path / …看到:

> http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/dyld.1.html
> http://lapcatsoftware.com/blog/2007/08/11/embedding-frameworks-in-loadable-bundles/
> How to distribute a Mac OS X with dependent libraries?
> Installing IB plugin

总结

以上是内存溢出为你收集整理的xcode – dylib @executable_path插件包中的路径问题全部内容,希望文章能够帮你解决xcode – dylib @executable_path插件包中的路径问题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1110959.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存