Reputation: 51
I know this has been asked to death, but I'm having trouble compiling a package in R on my M1 MacBook Air. I need DESeq2, which requires both RcppArmadillo and genefilter. I downloaded an older binary of RccpArmadillo, but genefilter doesn't seem to have one. I have edited my ~/.R/Makevars
file extensively, and on RStudio it throws an error related to lquadmath, but in the console it does not. I will post both errors. My ~/.R/Makevars
file is as follows:
CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CXX = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CXX11 = $CXX
CXX14 = $CXX
CXX17 = $CXX
CXX20 = $CXX
CFLAGS = -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration
CXXFLAGS = -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion
CXX11FLAGS = $CXXFLAGS
CXX14FLAGS = $CXXFLAGS
CXX17FLAGS = $CXXFLAGS
CXX20FLAGS = $CXXFLAGS
FC = /usr/local/gfortran/bin/gfortran
FLIBS = -L/usr/local/gfortran/lib/gcc/aarch64-apple-darwin20.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
The error I get when I try to install in the console is a repository index error, which most people seem to say is because of internet connection problems, but I am connected to the internet and can download other (binary and source) packages without issue. Here is that error:
> BiocManager::install("genefilter")
Bioconductor version 3.13 (BiocManager 1.30.15), R 4.1.0 (2021-05-18)
Installing package(s) 'genefilter'
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘genefilter’
Do you want to attempt to install these from sources? (Yes/no/cancel) yes
installing the source package ‘genefilter’
trying URL 'https://bioconductor.org/packages/3.13/bioc/src/contrib/genefilter_1.74.0.tar.gz'
Content type 'application/x-gzip' length 805682 bytes (786 KB)
==================================================
downloaded 786 KB
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -c half_range_mode.cpp -o half_range_mode.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c init.c -o init.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c nd.c -o nd.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c pAUC.c -o pAUC.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c rowPAUCs.c -o rowPAUCs.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c rowttests.c -o rowttests.o
/usr/local/gfortran/bin/gfortran -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c ttest.f -o ttest.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -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 genefilter.so half_range_mode.o init.o nd.o pAUC.o rowPAUCs.o rowttests.o ttest.o -L/usr/local/gfortran/lib/gcc/aarch64-apple-darwin20.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
The downloaded source packages are in
‘/private/var/folders/tl/40wd6m_91rldyqsnkwqqfdg40000gn/T/RtmpqhSbBH/downloaded_packages’
Old packages: 'RcppArmadillo'
Update all/some/none? [a/s/n]:
n
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 ‘genefilter’ had non-zero exit status
Lastly, when I try to install in RStudio I get the following errors:
> BiocManager::install("genefilter")
'getOption("repos")' replaces Bioconductor standard repositories, see '?repositories' for details
replacement repositories:
CRAN: https://cran.rstudio.com/
Bioconductor version 3.13 (BiocManager 1.30.15), R 4.1.0 (2021-05-18)
Installing package(s) 'genefilter'
Package which is only available in source form, and may need compilation of
C/C++/Fortran: ‘genefilter’
Do you want to attempt to install these from sources? (Yes/no/cancel) yes
installing the source package ‘genefilter’
trying URL 'https://bioconductor.org/packages/3.13/bioc/src/contrib/genefilter_1.74.0.tar.gz'
Content type 'application/x-gzip' length 805682 bytes (786 KB)
==================================================
downloaded 786 KB
* installing *source* package ‘genefilter’ ...
** using staged installation
** libs
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -c half_range_mode.cpp -o half_range_mode.o
half_range_mode.cpp:21:11: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
N = end - start;
~ ~~~~^~~~~~~
half_range_mode.cpp:89:30: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
N_double_prime = new_end - new_start;
~ ~~~~~~~~^~~~~~~~~~~
2 warnings generated.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c init.c -o init.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c nd.c -o nd.o
nd.c:245:5: warning: implicit conversion turns floating-point number into integer: 'double' to '_Bool' [-Wfloat-conversion]
if(x[i1] || x[i2]){
^~~~~ ~~
nd.c:245:14: warning: implicit conversion turns floating-point number into integer: 'double' to '_Bool' [-Wfloat-conversion]
if(x[i1] || x[i2]){
~~ ^~~~~
nd.c:246:7: warning: implicit conversion turns floating-point number into integer: 'double' to 'RSInt' (aka 'int') [-Wfloat-conversion]
ct += wval[j];
~~~^~~~~~~~~~
nd.c:247:10: warning: implicit conversion turns floating-point number into integer: 'double' to '_Bool' [-Wfloat-conversion]
if( !(x[i1] && x[i2]) ) ans += wval[j];
^~~~~ ~~
nd.c:247:19: warning: implicit conversion turns floating-point number into integer: 'double' to '_Bool' [-Wfloat-conversion]
if( !(x[i1] && x[i2]) ) ans += wval[j];
~~ ^~~~~
nd.c:247:32: warning: implicit conversion turns floating-point number into integer: 'double' to 'RSInt' (aka 'int') [-Wfloat-conversion]
if( !(x[i1] && x[i2]) ) ans += wval[j];
~~~~^~~~~~~~~~
6 warnings generated.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c pAUC.c -o pAUC.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c rowPAUCs.c -o rowPAUCs.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c rowttests.c -o rowttests.o
rowttests.c:45:28: warning: implicit conversion turns floating-point number into integer: 'double' to 'int' [-Wfloat-conversion]
n[grp][i] = s[grp][i] = ss[grp][i] = 0;
~ ~~~~~~~~~~^~~~~~~~~~~~~~~~
1 warning generated.
/usr/local/gfortran/bin/gfortran -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c ttest.f -o ttest.o
ttest.f:47:12:
47 | dm=dm1-dm2
| 1
Warning: Possible change of value in conversion from REAL(8) to REAL(4) at (1) [-Wconversion]
ttest.f:50:12:
50 | dm=dm1/dm2
| 1
Warning: Possible change of value in conversion from REAL(8) to REAL(4) at (1) [-Wconversion]
ttest.f:59:13:
59 | tst=(dm1-dm2)/sqrt((1.d0/ng1+1.d0/ng2)*(dss1+dss2)/(ng1+ng2-2))
| 1
Warning: Possible change of value in conversion from REAL(8) to REAL(4) at (1) [-Wconversion]
ttest.f:62:10:
62 | tst=(dm1-dm2)/sqrt(dss1/((ng1-1)*ng1)+dss2/((ng2-1)*ng2))
| 1
Warning: Possible change of value in conversion from REAL(8) to REAL(4) at (1) [-Wconversion]
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -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 genefilter.so half_range_mode.o init.o nd.o pAUC.o rowPAUCs.o rowttests.o ttest.o -L/usr/local/gfortran/lib/gcc/aarch64-apple-darwin20.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: library not found for -lquadmath
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [genefilter.so] Error 1
ERROR: compilation failed for package ‘genefilter’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/genefilter’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/genefilter’
The downloaded source packages are in
‘/private/var/folders/tl/40wd6m_91rldyqsnkwqqfdg40000gn/T/RtmpIiaMQO/downloaded_packages’
Old packages: 'RcppArmadillo'
Update all/some/none? [a/s/n]:
n
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 ‘genefilter’ had non-zero exit status
In addition to the URL errors, I also get the ld: library not found for -lquadmath clang: error: linker command failed with exit code 1 (use -v to see invocation)
error (though as far as I can tell I've correctly pointed to gfortran and gcc in my ~/.R/Makevars
file).
What am I doing wrong here? Why can I download other packages (I installed GOSeq, which also has dependencies that you need to compile) with no issue, but this one no? I have been working on this for hours and would really really appreciate any insight. Thank you!!
Upvotes: 5
Views: 7597
Reputation: 369
To install packages from source I prepend arch -arm64
when starting R
as in:
arch -arm64 R
and in R
everything just works as it used to on x86.
Upvotes: 1
Reputation: 31
Just saw this. I was trying to install DESeq2 earlier on an M1 Mac Air. Not sure which R 4.1 you are using, a possible answer may be here: https://support.bioconductor.org/p/9137290/
They mention Bioconductor does not support R4.1 for M1 macs and recommend using R4.1 for intel based macs.
Upvotes: 3