[R-SIG-Mac] Success with gfortran 5.1 on El Cap and R 3.3.0; was ... Error in compiling package with Fortran 4.8.2 on El Cap

David Winsemius dwinsemius at comcast.net
Thu Apr 21 22:04:59 CEST 2016


> On Apr 21, 2016, at 11:23 AM, Berend Hasselman <bhh at xs4all.nl> wrote:
> 
>> 
>> On 21 Apr 2016, at 19:15, David Winsemius <dwinsemius at comcast.net> wrote:
>> 
>> 18 months ago I volunteered to fix a very tiny error in the documentation in the abandoned package, muhaz, so I am now the maintainer. I'm trying to be a responsible maintainer and test my package with R 3.3.0 in advance of its release. (I hope the fact that I have not gotten any email notices from CRAN about failed installation attempts means that all is well with my package under the R 3.3.0 and CRAN's current build machine.) 
>> 
>> Since then I have migrated to El Capitan (which I believe is not yet the current build OS for OSX branches of R).  I was trying to be a responsible maintainer and test my package with R 3.3.0 in advance of its release.  I was getting an error when building from source that my googling efforts suggested is due to incompatibility between El Cap and earlier versions of Fortran. I do not usually get errors with source packages because I have attempted in my halting manner to keep an up-to-date toolchain: XCode, Command_Line_Tools_OS_X_10.11_for_Xcode_7.3 and up until now gfortran-4.8.2-darwin13 from the r.att.research.com site.
>> 
>> * installing to library ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library’
>> * installing *source* package ‘muhaz’ ...
>> ** package ‘muhaz’ successfully unpacked and MD5 sums checked
>> ** libs
>> gfortran-4.8   -fPIC  -g -O2  -c muhaz.f -o muhaz.o
>> gfortran-4.8: warning: couldn’t understand kern.osversion ‘15.4.0
>> f951: internal compiler error: Illegal instruction: 4
>> 
> 
> Are you compiling on a computer with an Intel Core 2 Duo?
> I had  that problem too.

This is on an early 2008 MacPro: Quad-Core Intel Xeon (and I was getting a different error relating to osversion.) This is the oldest MacPro that El Capitan supports and I'm wondering if the next OSX version will drop it from support.

 
> See here https://stat.ethz.ch/pipermail/r-sig-mac/2014-May/010894.html
> and Simon's reply.
> 
> I now have a computer with an i5 processor; the gfortran 4.8.2 from r.att.research.com works without that message.

That was the gfortran version that was throwing the error.

> 
>> The GNU Fortran Project mailing list has several contributions from François-Xavier Coudert who suggests that El Cap users install Fortran from a disk image installer that he makes available:
>> 
>> http://coudert.name/software.html
>> 
>> gfortran 5.2 for Yosemite:  http://coudert.name/software/gfortran-5.2-Yosemite.dmg  , which I downloaded.
>> .... noting that the author says "works well with El Capitan"
>> 
>> I've also found several other versions of gfortran at:
>> 
>> http://hpc.sourceforge.net/index.php
>> 
>> ... where versions 5.1, 5.3,and 6.0 are listed as appropriate for El Capitan.
>> 
>> It wasn't clear to me whether I needed to have matching sets of gcc and gfortran if I used these, but it appeared to me from the material I read in the R Install/Admin Guide that I would not need to add that additional complexity. 
>> 
>> I wondered:
>> 1) If I install this version of Fortran, what are my odds of failing to fix my problem and also crippling my capacity for compiling packages from source that were compiled and tested on Fortran 4.8.2. (I've decided to take the risk.)
>> 
>> 2) If I succeed with this for compiling muhaz, then will I later need to revert and what will I need to do to revert if needed.
>> 
> 
> In this thread https://stat.ethz.ch/pipermail/r-sig-mac/2015-October/011641.html
> Brian Ripley in reply to my query said that Coudert's gfortran could be used.

I see that now, but I instead read the Admin/Install document and thought it was specific enough to attempt a solution which fortunately succeeded. I didn't have a ~/.R/Makevars file and didn't know how it would work. I thought apparently incorrectly that such a file was designed only for environment variable settings. I got the impression that modifying Makeconf would be the preferred method. Appears I could have gone that route as well after reading Prof Ripley's posting.

I would not necessarily have found that thread because I was searching on the specific error message and the original poster upthread did not include any specifics. She apparently had enough knowledge to be satisfied with  "general" problems statements and the correspondingly general responses, while I'm somewhat more limited in my capacities to muck with "internals".

Best;
David


> 
> Berend
> 
>> Arguably I could have posted this on the package-devel mailing list, but since my best-guess is that specific interfaces with the Mac OS are at the heart of this issue, I'm sticking with R-sig-mac until advised to move on.
>> 
>> I've attempted to read through the Install/Admin document and have derived some knowledge:
>> 
>> a) from section 6.3 and $ R CMD INSTALL --help: may use:
>> 
>> --configure-args=ARGS
>> 			to set arguments for the configure scripts (if any)
>> 
>> b) sect 6.3.2:  "Entries [to either  `/Library/Frameworks/R.framework/Resources/etc/Makeconf` or `~/.R/Makevars`] which may need to be changed include ‘CC’, ‘CXX’, ‘FC’, ‘F77’, ‘FLIBS’ and the corresponding flags, and perhaps ‘CXXCPP’, ‘DYLIB_LD’, ‘MAIN_LD’, ‘SHLIB_CXXLD’, ‘SHLIB_FCLD’ and ‘SHLIB_LD’."
>> 
>> c) modifications to these might be placed in `~/.R/Makevars` but the next subsection says they could be placed in `HOME/.R/Makevars-R_PLATFORM` which I'm quite sure is a different location.
>> 
>> And then there is a three line example for setting up Fortran on a Mac which appeared extremely relevant to my growing list of questions. I noticed that it has reference to /usr/local/gfortran/bin/gfortran and then uses FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin14/5.2.0 which appeared to be a good match to the gfortran referenced above.
>> 
>> Emboldened by the resemblance of this worked example to the disk image mentioned above I ran the installation dialog and do now have exactly the folder structure implied by that three line config example. Now believe I can either repeat the INSTALL command with trailing configure-args, or modify Makeconf , or I can construct a config file of some sort in HOME/.R/Makevars-R_PLATFORM. I chose to do the second options since I was unable to divine what the proper incantation might be for the "R-PLATFORM" section of that string. I decided to replace the "gfortran section" with this, attempting to alter only those lines that matched the three altered lines in the Admin/Install example:
>> 
>> FC = /usr/local/gfortran/bin/gfortran
>> FCFLAGS = -Wall -g -O2 $(LTO)
>> ## additional libs needed when linking with $(FC), e.g. on Solaris
>> FCLIBS = 
>> F77 = /usr/local/gfortran/bin/gfortran
>> F77_VISIBILITY = 
>> FFLAGS = -g -O2 $(LTO)
>> FLIBS =  -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin14/5.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
>> FCPICFLAGS = -fPIC
>> FPICFLAGS = -fPIC
>> 
>> Then:
>> 
>> $ R CMD INSTALL /Users/davidwinsemius/muhaz_1.2.6.tar.gz 
>> 
>> Followed by compiler messages and R message and finally ...
>> * DONE (muhaz)
>> 
>> OK. I guess reading the manual and googling really does "work". 
>> 
>> -- 
>> 
>> David Winsemius
>> Alameda, CA, USA
>> 
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

David Winsemius
Alameda, CA, USA



More information about the R-SIG-Mac mailing list