[CMake] Help with fixup_bundle for Mac OS - @executable_path, @loader_path, @rpath

Sean McBride sean at rogue-research.com
Tue Feb 1 12:26:06 EST 2011


On Tue, 1 Feb 2011 08:39:08 -0800, Scott Fowler said:

>I have an application "Foo" which distributes a plugin for a separate
>application "Bar".  My plugin is dependent on libraries distributed with
>application "Foo".  When application "Bar" tries to load the plugin, the
>plugin will not load, as it cannot find the libraries distributed with "Foo".
>
>As far as I can tell this boils down to the @executable_path reference
>which fixup_bundle inserts into my binaries.
>
>>otool -L plugin.dylib
>@executable_path/../MacOS/libsomedependency.dylib
>@executable_path/../MacOS/libsomeotherdependency.dylib
>etc...
>
>When application "Bar" loads my plugin, I'm assuming that
>@executable_path resolves to the location of "Bar", but the plugin's
>dependent libraries are in Foo.app/Contents/MacOS, not in Bar.app/
>Contents/MacOS.
>
>All this leads me to believe that I should be using @loader_path or
>@rpath instead, but I don't see a way to do this using CMake as it
>appears that BundleUtilities.cmake and GetPrerequisites.cmake are
>hardcoded to use @executable_path.

Install names are such a PITA.  Here's a great overview:
<http://www.mikeash.com/pyblog/friday-qa-2009-11-06-linking-and-install-
names.html>

@loader_path was added in 10.4, and assuming you don't need to support
anything older, you should never use @executable_path because
@loader_path is the same or better.  Not sure if it will solve your
problem though.

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada




More information about the CMake mailing list