Dylib error 'Library not loaded' distributing application
I'm developing an app in objective-C++ that uses dynamic libraries of OpenCV and VTK but I've a problem on distribution, if I launch my app in a different system I got this issue:
Dyld Error Message:
Library not loaded: @executable_path/../Frameworks/libvtkCommon.5.6.1.dylib
Referenced from: /myApp.app/Contents/MacOS/myApp
Reason: no suitable image found. Did find:
/myApp.app/Contents/MacOS/../Frameworks/libvtkCommon.5.6.1.dylib: open() failed with errno=13
/myApp.app/Contents/MacOS/../Frameworks/libvtkCommon.5.6.1.dylib: open() failed with errno=13
I've rebuilt my dylibs with instal开发者_开发知识库l_name_tool to point to: @executable_path/../Frameworks
and in "build phase" of myApp's target I've added "copy files" phase with destination "Frameworks" for my dylibs. Where is the problem?
Check your application bundle and make sure the file that got copied into Frameworks is the actual dylib and not a symbolic link file. Also, did you run install_name_tool on both the dylib file and your executable? Look at this page under Shared Libraries for an example.
Also see this question.
精彩评论