Error in gcc to compile packages in MacOSX

In MacOSX, if you have homebrew installed:

To prevent an error during compilation of packages, modify these two files:

sudo vi /Library/Frameworks/R.framework/Versions/Current/Resources/etc/Makeconf

In "Makeconf" change the line beginning by: FLIBS = 

by:

FLIBS =  -L/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/current/gcc/aarch64-apple-darwin23/14 -L/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/current -lgfortran -lquadmath -lm

and the one beginning by: FC =
by
FC = /opt/homebrew/bin/gfortran -arch arm64

Create a file 
sudo vi ~/.R/Makevars

with 

FC = /opt/homebrew/Cellar/gcc/14.2.0/bin/gfortran
F77 = /opt/homebrew/Cellar/gcc/14.2.0/bin/gfortran
FLIBS = -L/opt/homebrew/Cellar/gcc/14.2.0/lib/gcc/current

The value 14.2.0 must be changed depending on the current version.

I try this but it didn't work:

FC = $(find /opt/homebrew/Cellar/gcc/* -maxdepth 0 -type d)"/bin/gfortran"
F77 = $(find /opt/homebrew/Cellar/gcc/* -maxdepth 0 -type d)"/bin/gfortran"
FLIBS = -L$(find /opt/homebrew/Cellar/gcc/* -maxdepth 0 -type d)"/lib/gcc/current"

Commentaires