Skip to content
Prev 11620 / 15075 Next

Installing source package/altering fortran location

Mick,

the linked path is governed by the library itself - in particular the ID entry of it. So, for example, R's libraries have:

$ otool -L /Library/Frameworks/R.framework/Resources/lib/libRblas.dylib
/Library/Frameworks/R.framework/Resources/lib/libRblas.dylib:
	/Library/Frameworks/R.framework/Versions/3.2/Resources/lib/libRblas.dylib (compatibility version 0.0.0, current version 0.0.0)
	/Library/Frameworks/R.framework/Versions/3.2/Resources/lib/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0)
	/Library/Frameworks/R.framework/Versions/3.2/Resources/lib/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

Note the first line - that is the ID line. When you link against that binary, that's what the resulting binary will refer to. I bet the FastR binary doesn't have the correct ID - you can fix it using 

install_name_tool -id <id-entry> <library>

so the above would be

install_name_tool -id /Library/Frameworks/R.framework/Versions/3.2/Resources/lib/libRblas.dylib /Library/Frameworks/R.framework/Versions/3.2/Resources/lib/libRblas.dylib

There a some projects that are clueless about OS X and require DYLD_LIBRARY_PATH because they don't set the id correctly. That is a bug in the library, you should never set DYLD_LIBRARY_PATH because it breaks the search path very badly (it is NOT the same as LD_LIBRARY_PATH on unix which people confuse a lot). A little more sane way is to use DYLD_FALLBACK_LIBRARY_PATH which is more akin to LD_LIBRARY_PATH on Linux, but only as a last resort.

Cheers,
Simon