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

前端之家收集整理的这篇文章主要介绍了xcode – dylib @executable_path插件包中的路径问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在开发一个插件捆绑包,说应用程序的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)上工作?谢谢.

解决方法

猜你在找的iOS相关文章