[R] path to libgfortran 'hardcoded' in R?

Rainer Hurling rhurlin at gwdg.de
Sat Oct 20 13:45:26 CEST 2007

I am using R-2.6.0 on FreeBSD 8.0-CURRENT (i386). In the last days I had 
problems when building packages SparseM, lme4 and randomForest.

The below message shows for randomForest, that 'libgfortran' was not 
found. The same error appeared with SparseM and lme4.

R CMD INSTALL randomForest_4.5-19.tar.gz
* Installing to library '/usr/local/lib/R/library'
* Installing *source* package 'randomForest' ...
** libs
gcc -std=gnu99 -I/usr/local/lib/R/include -I/usr/local/lib/R/include 
-I/usr/local/include    -fpic  -g -O2 -c classTree.c -o classTree.o
gcc -std=gnu99 -I/usr/local/lib/R/include -I/usr/local/lib/R/include 
-I/usr/local/include    -fpic  -g -O2 -c regTree.c -o regTree.o
gcc -std=gnu99 -I/usr/local/lib/R/include -I/usr/local/lib/R/include 
-I/usr/local/include    -fpic  -g -O2 -c regrf.c -o regrf.o
gcc -std=gnu99 -I/usr/local/lib/R/include -I/usr/local/lib/R/include 
-I/usr/local/include    -fpic  -g -O2 -c rf.c -o rf.o
gfortran   -fpic  -g -O2 -c rfsub.f -o rfsub.o
gcc -std=gnu99 -I/usr/local/lib/R/include -I/usr/local/lib/R/include 
-I/usr/local/include    -fpic  -g -O2 -c rfutils.c -o rfutils.o
gcc -std=gnu99 -shared -L/usr/local/lib -o randomForest.so classTree.o 
regTree.o regrf.o rf.o rfsub.o rfutils.o 
-L/usr/local/lib/gcc-4.2.2 -lgfortran -lm -lgcc_s -L/usr/local/lib/R/lib -lR
/usr/bin/ld: cannot find -lgfortran
*** Error code 1

Stop in /tmp/R.INSTALL.QXafuj/randomForest/src.
ERROR: compilation failed for package 'randomForest'
** Removing '/usr/local/lib/R/library/randomForest'
** Restoring previous '/usr/local/lib/R/library/randomForest'

Two weeks ago I upgraded from gcc-4.2.2 to gcc-4.2.3, so the search path 
for the library was not valid any more when trying to build these packages.

Rebuilding and installing R-2.6.0 itself does the job. Now these 
packages are able to find libgfortran and all packages install as expected.

Is it essential for packages like randomForest to get this library path 
from R itself? Or is this just an inaccuracy, not to say a bug?


More information about the R-help mailing list