Use @executable_path/../Frameworks as a runpath search path when linking both the plug-ins and the executable. @executable_path is the path to the executable for the process, @loader_path is the path to whatever loaded a binary by linking against it.
All true.
However I am using @rpath for a reason.
My plug-in bundles may contain auxiliary executables. In this case @executable_path/../Frameworks will resolve to the auxiliary executable path not the app executable path - hence no framework will be found (though it might be possible to create a link that points to the correct bundle location).
What does work is @loader_path/../../../../Frameworks. Both the plugin and the aux executable can find the framework.
However building a plug-in that is loaded from an alternate location now fails. Therefore @rpath seems to be the way to go.
@executable_path and @loader_path are suitable for simple scenarios. @rpath gives much greater flexibility when linking from multiple executables.
For instance if you decide to go with @loader_path/../../../../Frameworks then you run into issues when all of a sudden you want to link your main app against that framework too. Then you have to break out install_name_tool
I only realised I had a problem with linkage when running the app outside of xcode. Within running within xcode the frameworks were located even though the specified link paths were incorrect.
Regards
Jonathan Mitchell
Developer Mugginsoft LLP
|