[R-SIG-Mac] R-3.0.0: choice of gfortran compiler in install.packages()

Andy Jacobson (NOAA Affiliate) andy.jacobson at noaa.gov
Wed May 8 01:30:39 CEST 2013


Howdy,

I am attempting to install the fields_6.7.6 package under R-3.0.0 on OS X 10.7.5.  I think the install process is calling the wrong gfortran compiler.  The compiler being called is /usr/local/gfortran/bin/gfortran, which is "GNU Fortran (GCC) 4.4.0 20090321 (experimental) [trunk revision 144983]".  I've installed the gfortran-4.2.3.pkg package from http://cran.r-project.org/bin/macosx/tools/gfortran-4.2.3.pkg.

The /Library/Frameworks/R.framework/Versions/3.0/Resources/etc/Makeconf file specifies:

FC = gfortran-4.2 -arch x86_64
and
F77 = gfortran-4.2 -arch x86_64

The text output from install.packages() shows lots of -c compilation using this wrong gfortran, then attempts to link with llvm-gcc-4.2.  The linking step complains about the .o files being architecture i386, which is probably wrong output from the gfortran-4.4.0 compiler:

> /usr/local/gfortran/bin/gfortran   -fPIC  -g -O2  -c sortm.f -o sortm.o
> llvm-gcc-4.2 -arch x86_64 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/gfortran/lib/ -o fields.so css.o csstr.o cvrf.o dchold.o dcopy.o ddfind.o ddot.o derrb.o dlv.o dmaket.o drdfun.o dsetup.o evlpoly.o evlpoly2.o expfn.o ifind.o igpoly.o inpoly.o mltdrb.o mltdtd.o multeb.o multrb.o radbas.o radfn2.o radfun.o rcss.o rcssr.o rcsswt.o sortm.o -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64 -L/usr/local/lib/x86_64 -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3 -lgfortran -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
> ld: warning: ld: warning: ignoring file css.o, file was built for i386 which is not the architecture being linked (x86_64): css.oignoring file csstr.o, file was built for i386 which is not the architecture being linked (x86_64): csstr.o



There's no Makefile in the fields package, so FC and F77 are not being overridden by the package itself, I believe.  The FC and F77 variables from R's Makeconf are not being respected, and I've tried to specify alternative gfortran compilers with syntax like:


install.packages("fields",type="source",repos="http://cran.us.r-project.org",clean=TRUE,configure.vars=list(F77="gfortran-4.2 -arch x86_64",FC="gfortran-4.2 -arch x86_64"))

Nothing I do seems to tell the fields package to use the proper gfortran compiler.  I have no environment variables like FC or F77 defined.  I have to admit that I do have four different gfortran versions installed on this machine:  in addition to the R pkg version and the gfortran-4.4.0, there's a fink /sw/bin/gfortran 4.6.2, and a /usr/bin/gfortran-4.2 which claims to come from Apple (GNU Fortran (GCC) 4.2.1 (Apple Inc. build 5566)).  I'm up to date with Xcode.

Any advice about how to do this correctly would be much appreciated!

Thanks,

Andy
-- 
Andy Jacobson
andy.jacobson at noaa.gov

NOAA Earth System Research Lab
Global Monitoring Division
325 Broadway R/GMD1
Boulder, Colorado 80305

303/578-2237



More information about the R-SIG-Mac mailing list