12

私はプラグイン バンドルを開発しています。たとえば、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は MyPlugIn.bundle 実行可能パスではなく BigApp.app 実行可能パスに置き換えられているようです。

絶対パスなしで、Mac OS X 10.4 (Tiger)で動作するようにするための回避策はありますか? ありがとう。

4

1 に答える 1

17

Web およびその他の SO の質問から: の@loader_path/..代わりに使用し@executable_path/..ます。見る:

于 2010-01-19T15:09:41.517 に答える