[R-SIG-Mac] value of FLIBS and installation of packages from source
Kevin Ushey
kevinushey at gmail.com
Tue Nov 3 06:07:30 CET 2015
My understanding is that gfortran 4.2.3 was used with CRAN R built
with pre-Mavericks OSes (ie, before Apple made the move from gcc to
clang); nowadays gfortran 4.8.2 is used. Considering that you're on
Yosemite, you want to be installing gfortran 4.8.2.
Unfortunately, this information is not very well advertised on the
tools pages; it would be helpful if these pages were updated:
https://cran.r-project.org/bin/macosx/tools/
http://r.research.att.com/tools/
Best,
Kevin
On Mon, Nov 2, 2015 at 7:31 PM, Chris Paciorek
<paciorek at stat.berkeley.edu> wrote:
> Yes, good point, I think on one of my machines I did have gfortran
> from a different source.
>
> That said, on a different machine, I had Xcode and R installed but not
> gfortran. So I just now installed the 4.2.3 gfortran from CRAN, and as
> seen below, FLIBS is still pointing to a non-existent directory and
> while libgfortran.dylib is now available, libquadmath.dylib is not, so
> any installation from source of a package that uses FLIBS will fail
> (and will also warn about the non-existing
> /usr/local/lib/gcc/x86_64-apple-darwin13.0.0). That was with R 3.2.0.
> I also tried installing R 3.2.2 after gfortran 4.2.3 was already
> installed and FLIBS is still pointing to the non-existent location.
> (I'm guessing
> FLIBS in etc/Makeconf is being set based on the OS X version and
> not based on any looking for gfortran on the user's system.)
>
> So am I misreading things that the 4.2.3 gfortran provided by R is not
> fully compatible with R on recent OS X versions and that installing
> FLIBS-reliant packages from source will generally fail unless one gets
> the 4.8.2 gfortran? If that is the case, I do think it would be
> helpful if you could provide the 4.8.2 gfortran as the default so that
> users who try to install FLIBS-reliant packages from source will be
> able to.
>
> chris
>
> ===================
>
> paciorek at glinda:~/Downloads> R CMD config FLIBS
> -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm
>
> paciorek at glinda:~/Downloads> ls /usr/local/lib/gcc
> i686-apple-darwin8 powerpc-apple-darwin8
>
> paciorek at glinda:~/Downloads> ls /usr/local/lib/libgfortran*
> /usr/local/lib/libgfortran.2.0.0.dylib /usr/local/lib/libgfortran.dylib
> /usr/local/lib/libgfortran.2.dylib /usr/local/lib/libgfortran.la
> /usr/local/lib/libgfortran.a
>
> paciorek at glinda:~/Downloads> ls /usr/local/lib/libquadmath*
> ls: /usr/local/lib/libquadmath*: No such file or directory
>
> On Mon, Nov 2, 2015 at 6:35 PM, Simon Urbanek
> <simon.urbanek at r-project.org> wrote:
>>
>> On Nov 2, 2015, at 6:31 PM, Chris Paciorek <paciorek at stat.berkeley.edu> wrote:
>>
>>> I may have been unclear in my original message -- I had gfortran 4.2.3
>>> installed previously and was having the problem with that older
>>> version installed. With 4.2.3, if I _manually_ set FLIBS in
>>> etc/Makeconf to point to /usr/local/gfortran/lib, then the problem
>>> went away.
>>>
>>
>> ... but that is *not* what the CRAN Fortran uses - so I guess you had different Fortran installed - which is why it didn't work. I suspect that if you had actually [re?]installed the Fortran from Tools it would work, but you [or some script] have possibly removed the libraries from /usr/local/lib or had a different Fortran which is why you got the error.
>>
>> Cheers,
>> Simon
>>
>>
>>> Once I installed 4.8.2, things were fine without having to change
>>> FLIBS in etc/Makeconf.
>>>
>>> chris
>>>
>>> On Mon, Nov 2, 2015 at 3:03 PM, Simon Urbanek
>>> <simon.urbanek at r-project.org> wrote:
>>>>
>>>>> On Nov 2, 2015, at 4:50 PM, Chris Paciorek <paciorek at stat.berkeley.edu> wrote:
>>>>>
>>>>> Thanks, that worked. But is it a concern that users can't easily
>>>>> install a package on OS X from source? Perhaps not since there should
>>>>> be Mac binaries for packages on CRAN?
>>>>>
>>>>> In particular, on CRAN (https://cran.r-project.org/bin/macosx/tools/)
>>>>> I was seeing gfortran 4.2.3 and overlooked the note about more recent
>>>>> Fortran binaries. But even in clicking on that link to get to
>>>>> http://r.research.att.com/tools/, I don't see the 4.8.2 version.
>>>>> Should any of these items be updated? It's not clear to me how one
>>>>> would find 4.8.2 if one didn't know where to look.
>>>>>
>>>>
>>>> Either should work - at least last time I checked it did. If I understand your report you didn't have *any* Fortran libraries installed, but you need Fortran to compile Fortran packages -- on CRAN it says
>>>> "GNU Fortran isNOT included (needed if you want to compile packages from sources that contain FORTRAN code) please see the tools directory."
>>>>
>>>> That said, I guess it would be reasonable to provide a pkg for the Mavericks Fortran and add it to the tools as well.
>>>>
>>>> Cheers,
>>>> Simon
>>>>
>>>>
>>>>>
>>>>> On Mon, Nov 2, 2015 at 1:31 PM, Simon Urbanek
>>>>> <simon.urbanek at r-project.org> wrote:
>>>>>> Chris,
>>>>>>
>>>>>> it seems that you didn't install the necessary Fortran compiler from
>>>>>> http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2
>>>>>>
>>>>>> Cheers,
>>>>>> Simon
>>>>>>
>>>>>>
>>>>>>> On Nov 2, 2015, at 2:03 PM, Chris Paciorek <paciorek at stat.berkeley.edu> wrote:
>>>>>>>
>>>>>>> I'm having trouble installing a number of R packages from source on
>>>>>>> Mac OS X (Yosemite) when the packages reference FLIBS in their
>>>>>>> src/Makevars.
>>>>>>>
>>>>>>> I have what I think is a fairly standard R install on Yosemite -
>>>>>>> installed from R-3.2.2.pkg.
>>>>>>>
>>>>>>> Here's where an example install fails (in this case the 'actuar' package):
>>>>>>> clang -dynamiclib -Wl,-headerpad_max_install_names -undefined
>>>>>>> dynamic_lookup -single_module -multiply_defined suppress
>>>>>>> -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o
>>>>>>> actuar.so beta.o burr.o chisq.o dpq.o dpqphtype.o exp.o gamma.o
>>>>>>> genbeta.o genpareto.o hierarc.o init.o invburr.o invexp.o invgamma.o
>>>>>>> invgauss.o invparalogis.o invpareto.o invtrgamma.o invweibull.o
>>>>>>> lgamma.o llogis.o lnorm.o names.o normal.o panjer.o paralogis.o
>>>>>>> pareto.o pareto1.o phtype.o random.o randomphtype.o trbeta.o trgamma.o
>>>>>>> unif.o util.o weibull.o
>>>>>>> -L/Library/Frameworks/R.framework/Resources/lib -lRlapack
>>>>>>> -L/Library/Frameworks/R.framework/Resources/lib -lRblas
>>>>>>> -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran
>>>>>>> -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R
>>>>>>> -Wl,-framework -Wl,CoreFoundation
>>>>>>> ld: warning: directory not found for option
>>>>>>> '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
>>>>>>> ld: library not found for -lgfortran
>>>>>>> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>>>>>>>
>>>>>>> Some likely relevant facts:
>>>>>>>
>>>>>>> 1)
>>>>>>> /Library/Frameworks/R.framework/Resources/etc/Makeconf has
>>>>>>> FLIBS = -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2
>>>>>>> -lgfortran -lquadmath -lm
>>>>>>> but /usr/local/lib/gcc does not exist on my machine.
>>>>>>>
>>>>>>> 2) libquadmath.0.dylib and libgfortran.3.dylib exist in
>>>>>>> /Library/Framework/R.framework/Resources/lib
>>>>>>> The following kludge allows the 'actuar' package to be installed from source:
>>>>>>> cd /Library/Framework/R.framework/Resources/lib
>>>>>>> ln -s libgfortran.3.dylib libgfortran.dylib
>>>>>>> ln -s libquadmath.0.dylib libquadmath.dylib
>>>>>>>
>>>>>>> albeit of course still with the warning about the nonexistent
>>>>>>> /usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2
>>>>>>>
>>>>>>> 3) Alternatively I can install the gfortran Mac package provided by
>>>>>>> CRAN and manually set FLIBS in Makeconf to point to
>>>>>>> /usr/local/gfortran/lib
>>>>>>>
>>>>>>> So, any ideas why R is being installed such that FLIBS points to a
>>>>>>> non-existent directory? And for packages that don't need the fortran
>>>>>>> compiler, but merely libgfortran, is there a way to install packages
>>>>>>> that have FLIBS in their Makevars without installing the gfortran
>>>>>>> package and monkeying with FLIBS in Makeconf?
>>>>>>>
>>>>>>> I'll note that this is occurring on a few machines I have access to,
>>>>>>> including a new Macbook Air purchased in June 2015, with R and Xcode
>>>>>>> installed thereafter. So it doesn't seem that it is a result of having
>>>>>>> versions of OS X and command line tools from before Yosemite.
>>>>>>>
>>>>>>> I have command line tools installed:
>>>>>>>
>>>>>>> paciorek:/tmp> gcc --version
>>>>>>> Configured with:
>>>>>>> --prefix=/Applications/Xcode.app/Contents/Developer/usr
>>>>>>> --with-gxx-include-dir=/usr/include/c++/4.2.1
>>>>>>> Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
>>>>>>> Target: x86_64-apple-darwin14.3.0
>>>>>>> Thread model: posix
>>>>>>>
>>>>>>>
>>>>>>> Here's sessionInfo():
>>>>>>>
>>>>>>>> sessionInfo()
>>>>>>> R version 3.2.2 (2015-08-14)
>>>>>>> Platform: x86_64-apple-darwin13.4.0 (64-bit)
>>>>>>> Running under: OS X 10.10.3 (Yosemite)
>>>>>>>
>>>>>>> locale:
>>>>>>> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>>>>>>>
>>>>>>> attached base packages:
>>>>>>> [1] stats graphics grDevices utils datasets methods base
>>>>>>>
>>>>>>>
>>>>>>> thanks,
>>>>>>> Chris
>>>>>>>
>>>>>>> ----------------------------------------------------------------------------------------------
>>>>>>> Chris Paciorek
>>>>>>>
>>>>>>> Associate Research Statistician, Lecturer, Statistical Computing Consultant
>>>>>>>
>>>>>>> Office: 495 Evans Hall Email: paciorek at stat.berkeley.edu
>>>>>>> Mailing Address: Voice: 510-842-6670
>>>>>>> Department of Statistics Fax: 510-642-7892
>>>>>>> 367 Evans Hall Skype: cjpaciorek
>>>>>>> University of California, Berkeley WWW:
>>>>>>> www.stat.berkeley.edu/~paciorek
>>>>>>> Berkeley, CA 94720 USA Permanent forward:
>>>>>>> paciorek at alumni.cmu.edu
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> 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
More information about the R-SIG-Mac
mailing list