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

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu May 9 08:40:23 CEST 2013


Note that the recommended CRAN gfortran *does* go into /usr/local.  This 
one: http://cran.r-project.org/bin/macosx/tools/gfortran-4.2.3.pkg as 
described at 
http://cran.r-project.org/doc/manuals/r-release/R-admin.html#OS-X .

That's for R 3.0.0: other versions were recommended for earlier versions 
as add-ons to gcc versions which are no longer recommended.

If you are not using the recommended compiler with a CRAN binary build 
you should set some variables in ~/.R/Makevars: see 
http://cran.r-project.org/doc/manuals/r-release/R-admin.html#OS-X-packages .

On 08/05/2013 23:28, Davor Cubranic wrote:
> I don't see this on my  machine:
>
>> install.packages('fields', type='source')
> * installing *source* package 'fields' ...
> ** package 'fields' successfully unpacked and MD5 sums checked
> ** libs
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c css.f -o css.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c csstr.f -o csstr.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c cvrf.f -o cvrf.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c dchold.f -o dchold.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c dcopy.f -o dcopy.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c ddfind.f -o ddfind.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c ddot.f -o ddot.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c derrb.f -o derrb.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c dlv.f -o dlv.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c dmaket.f -o dmaket.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c drdfun.f -o drdfun.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c dsetup.f -o dsetup.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c evlpoly.f -o evlpoly.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c evlpoly2.f -o evlpoly2.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c expfn.f -o expfn.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c ifind.f -o ifind.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c igpoly.f -o igpoly.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c inpoly.f -o inpoly.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c mltdrb.f -o mltdrb.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c mltdtd.f -o mltdtd.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c multeb.f -o multeb.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c multrb.f -o multrb.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c radbas.f -o radbas.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c radfn2.f -o radfn2.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c radfun.f -o radfun.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c rcss.f -o rcss.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c rcssr.f -o rcssr.o
> gfortran-4.2 -arch x86_64   -fPIC  -g -O2  -c rcsswt.f -o rcsswt.o
> gfortran-4.2 -arch x86_64   -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/lib -L/usr/local/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: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64'
> ld: warning: directory not found for option '-L/usr/local/lib/x86_64'
> ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3'
> installing to /private/tmp/library/fields/libs
> ** R
> ** data
> ** preparing package for lazy loading
> ** help
> *** installing help indices
> ** building package indices
> ** testing if installed package can be loaded
> * DONE (fields)
>
> I'm also running R-3.0.0 and OS X 10.7.5, so I think the issue is your environment. Why do you have gfortran in /usr/local anyways? CRAN's fortran goes into /usr/bin.
>
> Note that you set FC and F77 to "gfortran-4.2" (no path), so that will look for it in your PATH, and you probably have /usr/local/gfortran/bin before /usr/bin. Try either removing /usr/local/gfortran directory or make sure the one in /usr/bin is found first.
>
> Davor
>
> On 2013-05-07, at 4:30 PM, Andy Jacobson (NOAA Affiliate) wrote:
>
>> 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
>>
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-SIG-Mac mailing list