-
assigned issue to
Dynamic linker lookup issues on macOS with SIP
Recent versions of OSX / macOS feature something called System Integrity Protection (https://support.apple.com/en-us/HT204899) which is supposed to make the operating system more robust to nasty software. Unfortunately, one consequence of this is that the dynamic library lookup mechanisms (and stuff like DYLD_FALLBACK_LIBRARY_PATH, https://github.com/oracle/node-oracledb/issues/231) are no longer searched by default. As a result, the mex file created does not work:
>> addpath(genpath(pwd))
>> PlanarSLAMExample
Invalid MEX-file '/Users/ucacsjj/Documents/Proj/Other/gts/install/gtsam_toolbox/gtsam_wrapper.mexmaci64':
dlopen(/Users/ucacsjj/Documents/Proj/Other/gts/install/gtsam_toolbox/gtsam_wrapper.mexmaci64, 6): Library not
loaded: libgtsam.4.dylib
Referenced from: /Users/ucacsjj/Documents/Proj/Other/gts/install/gtsam_toolbox/gtsam_wrapper.mexmaci64
Reason: image not found.
Error in gtsam.symbol (line 3)
varargout{1} = gtsam_wrapper(2867, varargin{:});
Error in PlanarSLAMExample (line 25)
i1 = symbol('x',1); i2 = symbol('x',2); i3 = symbol('x',3);
The libraries used to create the mex file are:
Hnatt:gtsam_toolbox ucacsjj$ otool -L gtsam_wrapper.mexmaci64
gtsam_wrapper.mexmaci64:
libgtsam.4.dylib (compatibility version 4.0.0, current version 4.0.0)
/usr/local/opt/tbb/lib/libtbb.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/opt/tbb/lib/libtbbmalloc.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/opt/boost/lib/libboost_serialization-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/opt/boost/lib/libboost_system-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/opt/boost/lib/libboost_filesystem-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/opt/boost/lib/libboost_thread-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/opt/boost/lib/libboost_date_time-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/opt/boost/lib/libboost_timer-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/opt/boost/lib/libboost_chrono-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
libmetis.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
@rpath/libmex.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libmx.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.4.0)
Note that neither libgtsam.4.dylib nor libmetis.dylib have a path associated with them. Because SIP is running, the OS cannot look up the libraries and setting environment variables will not change this.
The way to sort this out is to set the INSTALL_NAME_DIR property (https://cmake.org/cmake/help/v3.0/prop_tgt/INSTALL_NAME_DIR.html) on the target when it is built.
I'll set up a branch / pull request to propose some changes.
Comments (4)
-
-
@SJulier did you make a pull request for this?
-
reporter Dear Mustafa,
From what I recall, I made a PR and the changes were merged by Frank in January.
Cheers,
Simon
-
- changed status to resolved
Thank for the response and the PR!
Closing this -- fixed in PR #307
- Log in to comment