On May 23, 2013, at 4:18 PM, Xiao He <praguewaterme...@gmail.com> wrote:

> Dear all,
> 
> I have a C++ code. To create a shared object from this particular code, I
> had to install a Fortran library on my computer (Mac). The compiled code
> runs fine on my computer. However,  if I try to dyn.load() said shared
> object on a computer that does not have the Fortran library installed, the
> object won't load, and instead I get a message below:
> 
> usr/local/lib/libgfortran.2.dylib
> Referenced from: /Users/xh/Downloads/foo2.so
> 
> I wonder if there is any way to compile the original C++ code such that I
> can include the necessary components of the Fortran library without having
> to install the library.
> 

The Fortran run-time is included with R, so you only need to change the path -- 
e.g.

install_name_tool -change /usr/local/lib/libgfortran.2.dylib 
/Library/Frameworks/R.framework/Resources/lib/libgfortran.2.dylib 
/Users/xh/Downloads/foo2.so

You can make that permanent on your build machine by running

install_name_tool -id  
/Library/Frameworks/R.framework/Resources/lib/libgfortran.2.dylib 
/usr/local/lib/libgfortran.2.dylib

If you do that, all code compiled against it subsequently will point to the 
version inside R instead.

Cheers,
Simon

FWIW: There is R-SIG-Mac for Mac-specific questions.


> 
> Thank you in advance.
> 
> Best,
> Xiao
> 
>       [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to