Skip to content

Compiling a portable binary that includes Fortran code

3 messages · Diego M Salvanha, Simon Zehnder, Simon Urbanek

7 days later
#
Diego,

if you compiled the binary on your Mac with gfortran installed the library created still links to the libgfortran.3.dylib library. In your package shared object file there is now a link to the libgfortran.3.dylib library and when installing to R, this link is searched for but cannot be found, as it is on your Mac and not on the user?s Mac. I guess, if you include the static library instead of the dynamic things work. 

First look into the shared object file of your package: 
On the Shell type: otool -L yourpackagename.so
There should be a link to libgfortran.3.dylib
Second, check if libgfortran.a exists: 
On The shell type: locate libgfortran 

Now if it does, try the following:
Open your Makevars and add the line
PKG_LIBS = -L/path/to/your/libgfortran.a 

Then recompile and try to install the binary. 
Also look again into the shared object file with tool -L and check if libgfortran is still in there.

May it helps

Simon
On 05 Nov 2013, at 22:13, Diego M Salvanha <dinarussia at gmail.com> wrote:

            
#
On Nov 13, 2013, at 4:26 AM, Simon Zehnder <szehnder at uni-bonn.de> wrote:

            
FWIW if you use recommended tools then this is non-issue since R ships with libgfortran, so the problem is really in the tools used, not in R nor the package.

Cheers,
Simon