Reputation: 987
I build my OSX application using XCode 5.1.1 and link to a .dylib. I've set up Build Phases -> Copy Files to copy the .dylib in the Frameworks destination.
When I launch from XCode it works fine, but when I double-click launch the .app bundle from Finder, it complains it cannot find the dylib, which XCode has dutifully placed under Contents/Frameworks, which can be easily verified in finder.
otool -L on my executable reveals that it is looking for
@loader_path/libXYZ.dylib (compatibility version 1.0.0, current version 1.0.0)
I can hack around this easily by using install_name_tool on my executable as follows:
install_name_tool -change @loader_path/libXYZ.dylib @executable_path/../Frameworks/libXYZ.dylib my_exec
but that change is lost on each re-build obviously. How can I tell XCode to set up the @executable_path../Frameworks in the first place?
Upvotes: 1
Views: 2137