[CMake] Adding dylib with either @rpath or absolute paths to osx cmd line executable target
Clinton Stimpson
clinton at elemtech.com
Tue Feb 19 11:58:06 EST 2013
Have you looked at using "install_name_tool -id" to change the id of the
shared library.
If you do install_name_tool -id @rpath/libiomp5.dylib /path/to/libiomp5.dylib
Then when you link dylibLinkTest and then check it with otool -L, it will
already have "@rpath/libiomp5.dylib" instead of just a plain "libiomp5.dylib"
With that, there will be no need to constantly fix your executables with
install_name_tool each time you link.
BundleUtilities pulls all the dependencies into a bundle and uses
@executable_path. BundleUtilities does not support @rpath, except that it is
recognized and changed to @executable_path.
Clint
On Friday, February 15, 2013 06:57:35 PM Bart Nabbe wrote:
> Hi,
>
> I'm sure I just overlooked something, but I can not get shared libraries (at
> a non system location) to load properly at runtime after having had them
> linked properly. If I run otool -L the library is listed without any path
> or loader reference: dylibLinkTest:
> libiomp5.dylib (compatibility version 5.0.0, current version 5.0.0)
> libtbb.dylib (compatibility version 0.0.0, current version 0.0.0)
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
> 159.1.0) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current
> version 52.0.0)
>
>
> I can use the install_name_tool to change these to @rpath/libiomp5.dylib and
> @rpath/libtbb.dylib respectively and all is well (I set rpath with a linker
> option in my CMakeLists.txt). From searching I did learn about the
> BundleUtilities, but I'm not quite sure how I would use it or if it would
> really be suitable to solve the problem.
>
> Any suggestions would be greatly appreciated.
>
>
> Thanks,
>
> Bart
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
--
Clinton Stimpson
Elemental Technologies, Inc
Computational Simulation Software, LLC
www.csimsoft.com
More information about the CMake
mailing list