xcode – dylib @executable_path插件包中的路径问题
2019年11月05日
作者:佚名
我正在开发一个插件捆绑包,说应用程序的MyPlugIn.bundle,说BigApp.app.这个bundle需要一个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)上工作?谢谢.解决方法
从网络和其他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插件包中的路径问题所遇到的程序开发问题。
如果觉得来客网网站内容还不错,欢迎将来客网网站推荐给程序员好友。