gmt icon indicating copy to clipboard operation
gmt copied to clipboard

Incompatibilities when using GMT macOS bundle from the externals

Open PaulWessel opened this issue 3 years ago • 3 comments

Description of the problem

The general issue here is the problem of Matlab, Julia, and Python finding the right GMT libraries and dependencies. For the GMT/MEX toolbox the only way I could fix this for macOS was to rename shared libraries with the share/tools/gmt_prepmex.sh which creates a new libgmt.dylib and set of dependencies with different names than what Matlab expects (i.e., libXnetcdf instead of libnetcdf). This is an awkward solution fueled by general ignorance, but it does seem to work.

Another option to be explored is the use of the environmental setting LD_PRELOAD which may possibly help us list the required dependencies we want to avoid a dependency conflict with the loading program. Looking at libgmt.dylib on macOS, I see this list of non-GMT shared libraries:

/opt/local/lib/libnetcdf.19.dylib (compatibility version 19.0.0, current version 19.0.0)
	/opt/local/lib/libcurl.4.dylib (compatibility version 12.0.0, current version 12.0.0)
	/opt/local/lib/libgdal.29.dylib (compatibility version 30.0.0, current version 30.1.0)
	/opt/local/lib/libgeos_c.1.dylib (compatibility version 16.0.0, current version 16.2.0)
	/opt/local/lib/libpcre.1.dylib (compatibility version 4.0.0, current version 4.13.0)
	/opt/local/lib/libfftw3f.3.dylib (compatibility version 10.0.0, current version 10.10.0)
	/opt/local/lib/libfftw3f_threads.3.dylib (compatibility version 10.0.0, current version 10.10.0)
	/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)
	/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)

If one does set export LD_PRELOAD=/opt/local/lib/libnetcdf.19.dylib:/opt/local/lib/libcurl.4.dylib:..., do we also need to add the (long) list of dependencies that these libraries need (e.g., proj for gdal etc)?

PaulWessel avatar Dec 16 '21 21:12 PaulWessel

xref:

  • https://github.com/GenericMappingTools/gmt/issues/1930

maxrjones avatar Dec 16 '21 21:12 maxrjones

Yes so the above cross-ref does have the solution, apparently, but we never actually tried to make this work in the bundle building itself.

PaulWessel avatar Dec 16 '21 21:12 PaulWessel

Don't know. The problem is that damn @executable_path/ that seems to be interpreted literally by the loadlibrary in Julia

joa-quim avatar Dec 16 '21 23:12 joa-quim