cannot install edgeR on M1 Mac
2
2
Entering edit mode
Brian ▴ 90
@e2919aea
Last seen 3.4 years ago
United Kingdom

Hello I'm having problem installing edgeR. it says gfortran lib is missing, wonder if anyone has a solution? Thanks!


clang++ -arch arm64 -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o edgeR.so R_add_prior_count.o R_ave_log_cpm.o R_calculate_cpm.o R_check_poisson_bound.o R_compute_apl.o R_compute_nbdev.o R_exact_test_by_deviance.o R_fit_levenberg.o R_fit_one_group.o R_get_one_way_fitted.o R_initialize_levenberg.o R_loess_by_col.o R_maximize_interpolant.o R_process_hairpin_reads.o R_simple_good_turing.o add_prior.o adj_coxreid.o fmm_spline.o glm_levenberg.o glm_one_group.o init.o interpolator.o nbdev.o objects.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0 -L/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0'
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [edgeR.so] Error 1
ERROR: compilation failed for package ‘edgeR’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/edgeR’

The downloaded source packages are in
    ‘/private/var/folders/1v/7vl3drys41vcrn588hn9wnf40000gp/T/RtmpSCfb5b/downloaded_packages’
Warning messages:
1: In .inet_warning(msg) :
  unable to access index for repository https://bioconductor.org/packages/3.13/bioc/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/bioc/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
2: In .inet_warning(msg) :
  unable to access index for repository https://bioconductor.org/packages/3.13/data/annotation/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/data/annotation/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
3: In .inet_warning(msg) :
  unable to access index for repository https://bioconductor.org/packages/3.13/data/experiment/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/data/experiment/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
4: In .inet_warning(msg) :
  unable to access index for repository https://bioconductor.org/packages/3.13/workflows/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/workflows/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
5: In .inet_warning(msg) :
  unable to access index for repository https://bioconductor.org/packages/3.13/books/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/books/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
6: In .inet_warning(msg) :
  installation of package ‘edgeR’ had non-zero exit status
> 
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Big Sur 11.4

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

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] limma_3.48.1

loaded via a namespace (and not attached):
[1] BiocManager_1.30.16 compiler_4.1.0      tools_4.1.0
apple m1 installation silicon • 16k views
ADD COMMENT
1
Entering edit mode

ld: library not found for -lgfortran

See https://mac.r-project.org/tools/

ADD REPLY
0
Entering edit mode

Your post shows an errror message but doesn't show the R code that produced this message. What R code did you use?

I'm not sure if this is relevant, but edgeR does not contain Fortran code.

ADD REPLY
1
Entering edit mode

At the linking stage, for packages with C or C++ or fortran code, the elements identified in R CMD config FLIBS must be present. On my M1 mac, using

R version 4.1.0 RC (2021-05-10 r80294) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)

the value of FLIBS is

PC002284:BIOC_SOURCES vincentcarey$ R CMD config FLIBS
-L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0 -L/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lm

@ATpoint gives the clue on how to get the necessary resource.

Until binary package distribution for M1 mac is undertaken -- and we don't have a date for this yet -- M1 mac users will need to be able to install from source.

ADD REPLY
0
Entering edit mode

I guess I should qualify this -- probably if you use R in x86 mode on M1 mac you can just use the standard mac binaries for Bioconductor packages. I haven't tried that.

ADD REPLY
0
Entering edit mode

Mine looks exactly the same:

yhbl2@them1brain ~ % R CMD config FLIBS                                                        
-L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0 -L/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lm

and I have gfortran installed:

yhbl2@them1brain ~ % gfortran -v       
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/gfortran/libexec/gcc/aarch64-apple-darwin20.2.0/11.0.0/lto-wrapper
Target: aarch64-apple-darwin20.2.0
Configured with: ../gcc-darwin-arm64/configure --prefix=/usr/local/gfortran --with-gmp=/Users/brew/FX/deps --with-isl=/Users/brew/FX/deps --enable-languages=c,c++,fortran,objc,obj-c++ --build=aarch64-apple-darwin20.2.0 --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201205 (experimental) (GCC) 
ADD REPLY
0
Entering edit mode

Hi Gordon,

I was trying to install edgeR from source but it failed to compile:

BiocManager::install('edgeR')

the x86 version works well on my older macs.

Thanks Brian

ADD REPLY
0
Entering edit mode

OK, I understand now the issue is that you are running R compiled for the Mac M1 ARM-based processor but Bioconductor doesn't provide binaries for that processor, so you need to install from source using ARM compilers.

ADD REPLY
0
Entering edit mode

Hi--I recommend seeing the suggestions in response to this post. It solved ALL of my problems with this type of installation!

https://stackoverflow.com/questions/67680663/installing-specific-r-packages-from-source-with-apple-m1-chip-causing-repository

Good luck!

ADD REPLY
7
Entering edit mode
Brian ▴ 90
@e2919aea
Last seen 3.4 years ago
United Kingdom

OK I managed to get it fixed.

I had to change FLIBS in

/Library/Frameworks/R.framework/Resources/etc/Makeconf

from:

FLIBS =  -L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0 -L/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lm

to:

FLIBS =  -L/usr/local/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0 -L/usr/local/gfortran/lib -lgfortran -lm

I also made symbolic links for all library files located in /usr/local/gfortran/lib to /usr/local/lib but this step may not be necessary.

> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Big Sur 11.4

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

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] edgeR_3.34.0 limma_3.48.1

loaded via a namespace (and not attached):
[1] BiocManager_1.30.16 compiler_4.1.0      tools_4.1.0         Rcpp_1.0.6          grid_4.1.0         
[6] locfit_1.5-9.4      lattice_0.20-44
ADD COMMENT
0
Entering edit mode

I had to install gfortran here https://mac.r-project.org/tools/, then I did this and it solved my problem. I was getting the exact same error (for scuttle dependency) from installing scater with

BiocManager::install("scater")

Thanks!!

ADD REPLY
0
Entering edit mode

I had the same problem, I followed your answer but with one variation: I did not make the symbolic links, instead I changed the FC in the Makeconf file:

FC = /opt/R/arm64/bin/gfortran -mtune=native

to this:

FC = /usr/local/gfortran/bin/gfortran -mtune=native

Now it works well for me.

ADD REPLY

Login before adding your answer.

Traffic: 602 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