[R-SIG-Mac] Installing source package/altering fortran location

Mick Jordan mick.jordan at oracle.com
Wed Mar 16 22:41:28 CET 2016

On 3/16/16 2:33 PM, Simon Urbanek wrote:
> 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.
Thanks, our mails crossed, but I appreciate the explanation. It was a 
typo on DYLD. We did use to set the DYLD_FALLBACK_LIBRARY_PATH but we 
don't any more as it doesn't work on El Cap with shells in the path.

I was actually using install_name_tool -change in our build of the 
stats.so to patch up the refs to lapack and blas. Now I can nuke that as 
the id change will now get it right.


More information about the R-SIG-Mac mailing list