gfortran 6.3.0 to compile package

Update: 30/7/2021

The latest gfortran is package in gcc for Mac brew:

First install homebrew, using in terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then install llvm
brew install --with-clang llvm


The latest version of fortran can be found here:
https://gcc.gnu.org/wiki/GFortranBinaries#MacOS

It is currently the version 6.3.0 for Sierra. However some packages still want use the 6.1.0 version for installation. Here is a solution to update gfortran.

First, remove all previous old fortran installation, for example the 4.8.2:
Here is the code from http://thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error/

# Download installer into working directory
curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2

# Remove _files_ associated with the binary
for file in $(tar tfz gfortran-4.8.2-darwin13.tar.bz2); do
   sudo rm -f /$file; 
done

# Remove empty _folders_ associated with the binary
for file in $(tar tfz gfortran-4.8.2-darwin13.tar.bz2); do 
   sudo rmdir -p /$file; 
done

# Delete the installer
rm -rf gfortran-4.8.2-darwin13.tar.bz2

Now download 6.3.0 version here:
https://gcc.gnu.org/wiki/GFortranBinaries#MacOS
And install it normally using .pkg

Then make a symbolic link to let think the installer from your package that the 6.1.0 version is present:
cd /usr/local/gfortran/lib/gcc/
sudo mkdir x86_64-apple-darwin15
cd x86_64-apple-darwin15
sudo ln -s ../x86_64-apple-darwin16/6.3.0 6.1.0
cd $HOME

And next time that you will install a package requiring fortran 6.1.0, it will not show any message such as:
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'

(tested with install.packages("VGAM"))

I keep this information also; it can be very useful:
To see the structure of a directory:
from http://thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error/
## Assumes homebrew is installed
# brew install tree 
curl -O ~/Downloads/gfortran-4.8.2-darwin13.tar.bz2  http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2
tar fvxz gfortran-4.8.2-darwin13.tar.bz2
tree usr

Commentaires

Posts les plus consultés de ce blog

Standard error from Hessian Matrix... what can be done when problem occurs

stepAIC from package MASS with AICc

Install treemix in ubuntu 20.04