'Problem with gcc/fortran compilers in new version of R (mac M1)

I have a MacBook Pro with an M1 chip. I need to update to the latest version of bioconductor (v3.15). As the documentation says this version is built/requires R v4.2

As such I updated and my current R set-up is:

R version 4.2.0 (2022-04-22)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.3.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

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     

loaded via a namespace (and not attached):
[1] compiler_4.2.0 tools_4.2.0

However, when I then tried to install bioconductor I ran into a number of compiler errors.

To overcome I first updated my gcc/gfortran via homebrew to the following:

gcc --version
\Apple clang version 13.1.6 (clang-1316.0.21.2.3)
Target: arm64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin


gfortran --version
GNU Fortran (Homebrew GCC 11.3.0) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

However I still get the compiler issues, specifically due to the location of gcc/gfortran. I installed gfortran via homebrew

I have read this post here and wanted to know if I could adapt this line sudo ln -sfn $(xcrun --show-sdk-path) /opt/R/arm64/gfortran/SDK so that it points to my homebrew installation of gfortran (/opt/homebrew/bin/gfortran)?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source