繁体   English   中英

使用 Apple M1 芯片从源安装特定的 R 包导致存储库索引或 -lquadmath 错误

[英]Installing specific R packages from source with Apple M1 chip causing repository index or -lquadmath error

我知道这已经被要求死了,但是我在我的 M1 MacBook Air 上编译 package in R 时遇到了问题。 我需要 DESeq2,它需要 RcppArmadillo 和 genefilter。 我下载了一个旧的 RccpArmadillo 二进制文件,但 genefilter 似乎没有。 我已经广泛编辑了我的~/.R/Makevars文件,在 RStudio 上它抛出了与 lquadmath 相关的错误,但在控制台中它没有。 我将发布这两个错误。 我的~/.R/Makevars文件如下:

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

当我尝试在控制台中安装时出现的错误是存储库索引错误,大多数人似乎说这是因为 inte.net 连接问题,但我已连接到 inte.net 并且可以下载其他(二进制和源代码) ) 包没有问题。 这是错误:

> 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

最后,当我尝试在 RStudio 中安装时,出现以下错误:

> 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

除了 URL 错误之外,我还收到ld: library not found for -lquadmath clang: error: linker command failed with exit code 1 (use -v to see invocation)错误(尽管据我所知我已经在我的~/.R/Makevars文件中正确指向 gfortran 和 gcc)。

我在这里做错了什么? 为什么我可以下载其他包(我安装了 GOSeq,它也有你需要编译的依赖项)没有问题,但这个没有? 我已经为此工作了几个小时,非常感谢任何见解。 谢谢!!

刚看到这个。 我之前试图在 M1 Mac Air 上安装 DESeq2。 不确定您使用的是哪个 R 4.1,可能的答案可能在这里: https://support.bioconductor.org/p/9137290/

他们提到 Bioconductor 不支持 M1 mac 的 R4.1,并建议将 R4.1 用于基于 intel 的 mac。

要从源代码安装包,我在启动R时添加了arch -arm64 ,如下所示:

arch -arm64 R

R中,一切都像在 x86 上一样工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM