[CMake] Weirdness with shared library, RPATH policy on MacOS
Chris Wolf
cw10025 at gmail.com
Fri Aug 13 09:25:28 EDT 2010
I have confirmed that the RPATH handling, as documented here:
http://www.cmake.org/Wiki/CMake_RPATH_handling
Is only accurate for the Linux case and *NOT* for MacOS.
Here is the summary of my findings:
"Default RPATH":
http://www.cmake.org/Wiki/CMake_RPATH_handling#Default_RPATH_settings
link in build: full build path rpath
link on install: installed executable will have no rpath
Linux: yes - works as documented, must set LD_LIBRARY_PATH for installed
executable to find shared lib in non-standard install dir
MacOS: no - installed executable rpath is still set to full build rpath,
(was supposed to be empty rpath)
must set LD_LIBRARY_PATH for installed
executable to find shared lib in non-standard install dir
"Always Use RPATH":
http://www.cmake.org/Wiki/CMake_RPATH_handling#Always_full_RPATH
Linux: yes - works as documented, build executable uses build rpath,
installed executable uses installed rpath
MacOS: no - installed executable rpath is still set to full build rpath
(was supposed to be installed lib rpath)
must set LD_LIBRARY_PATH for installed
executable to find shared lib in non-standard install dir
"No relinking and full RPATH for the install tree":
http://www.cmake.org/Wiki/CMake_RPATH_handling#No_relinking_and_full_RPATH_for_the_install_tree
Linux: yes - works as documented; to run executable in build tree, must
set LD_LIBRARY_PATH=.
MacOS: no - executable has no RPATH for build tree, (as expected)
although executable finds library in current working directory (build)
installed executable *also* has no RPATH; (was supposed to be installed lib rpath)
must set DYLD_LIBRARY_PATH for installed
executable to find shared lib in non-standard install dir.
otool -L shows no RPATH in both executable cases
I would like to get scenario #2 or #3 working on MacOS.
Thanks,
-Chris
More information about the CMake
mailing list