[GRASS-dev] linking update for OS X - makefile help needed

William Kyngesburye woklist at kyngchaos.com
Sun Oct 18 11:57:16 PDT 2015


To get GRASS working in the latest OS X, El Capitan/10.11, I believe the key is that the SIP security ignores DYLD_LIBRARY_PATH (an easy code injection method).  So, library linking needs to be relative, with @loader_path and @executable_path.  This change will still work on older OS X versions.

Libraries and loadable modules (like db drivers) should link to other libraries with @loader_path.  I got the library part figured out - change the install_name in SHLIB_LD set in configure.

The drivers and executables (both modules and etc helpers) is where it gets messy.  When linked normally, they will link the @loader_path/libname.dylib as now set in the libraries, but this won’t work.  So they need to be changed, install_name_tool is what will do this.  Ideally the makefile should loop through only the dependent GRASS libraries and change them to a relative @executable_path.  I think the place to do this, for modules at least, is in Module.make, after the linking step, but there I’m stuck.  The GRASS makefiles are doing things beyond my basic makefile skills.

The (shell) command needed is something like:

install_name_tool -change @loader_path/{LIBNAME}.dylib @executable_path/../lib/{LIBNAME}.dylib /path/to/executable

the ../lib works for standard modules that are one-deep in the module type subfolders and the top levels of etc/ and drivers/, but would need to be adjusted to backtrack more for the db drivers and etc/ subfolder helpers.  For loaded items like the drivers, the @executable_path part should be @loader_path.

Can the makefile gurus get me started on something I can test?

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"I ache, therefore I am.  Or in my case - I am, therefore I ache."

- Marvin




More information about the grass-dev mailing list