Problem with gcc/fortran compilers in new version of Bioconductor (Mac M1)
0
0
Entering edit mode
Olivia • 0
@e11c2ea8
Last seen 2.5 years ago
United Kingdom

I have a MacBook Pro with an M1 chip. I have updated to the latest version of bioconductor (v3.15), however I am unable to install bioconductor packages due to compilation errors.

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 packages 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 tried to adapt the 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

I have also tried the method suggested here but still run into the same compilation errors.

If anyone has any suggestions or has run into a similar issue, any advice would be much appreciated!

biocmanager R gofortran Bioconductor • 4.1k views
ADD COMMENT
0
Entering edit mode

What is the error message you get when installing a bioconductor package? It may not help but sometimes just reloading your R session after updating your R version solve the problem

ADD REPLY
0
Entering edit mode

The relevant part of the error message is below, and I get this for any bioconductor package I've try to install. I have restarted R each time I've updated the command line relating to gcc/gofortran etc and after updating R and bioconductor.

ERROR: compilation failed for package ‘pcaMethods’
    * removing ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/pcaMethods’
    * installing *source* package ‘genefilter’ ...
    ** using staged installation
    ** libs
    /usr/bin/g++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/homebrew/include   -fPIC  -std=c++11 -c half_range_mode.cpp -o half_range_mode.o
    In file included from half_range_mode.cpp:1:
    In file included from /Library/Frameworks/R.framework/Resources/include/R.h:42:
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:642:26: error: no template named 'numeric_limits'
        bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
                             ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:642:60: error: no template named 'numeric_limits'
        bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
ADD REPLY
0
Entering edit mode

One strategy is to continue to use the Intel version of R and run it using Rosetta. You can then use the binary packages provided by Bioconductor, so you don't need to compile anything. From what I've read there's almost no performance difference between running the native M1 version compared to the Intel version, but it might save you a lot of headaches getting stuff like this set up.

ADD REPLY

Login before adding your answer.

Traffic: 535 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6