【发布时间】:2021-03-26 12:49:14
【问题描述】:
我一直在尝试许多不同的方法来安装 RcppArmadillo,但我没有得到它的工作
install.packages(c('Rcpp'))
Sys.setenv("PKG_CXXFLAGS"="-std=c++11")
install.packages(c('RcppArmadillo'),type = "source")
它给了我这个错误:
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
ld: library not found for -lquadmath
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [RcppArmadillo.so] Error 1
ERROR: compilation failed for package ‘RcppArmadillo’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo’
显然,我没有x86_64-apple-darwin18/8.2.0,因为我安装了gfortran for the apple silicon architecture。
Mac 版本:
macOS Big Sur
11.2.3
Apple M1
R 版本:
version
_
platform x86_64-apple-darwin17.0
arch x86_64
os darwin17.0
system x86_64, darwin17.0
status
major 4
minor 0.4
year 2021
month 02
day 15
svn rev 80002
language R
version.string R version 4.0.4 (2021-02-15)
nickname Lost Library Book
【问题讨论】:
-
我无法为您解答,但一直听说 R 的 M1 设置在使用 Fortran 时仍然存在问题——这就是我所知道的。我建议检查 r-sig-mac 邮件列表。
-
好的,我发现修改 Makeconf 可能是一个解决方案。 stackoverflow.com/questions/23916219/…
-
将 FLIBS 更改为
FLIBS = -L/usr/local/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm时没有警告,但我仍然收到库-lquadmath未找到的错误 -
我在原生 M1 上安装 RcppArmadillo 没有问题。我使用了这些安装说明:r-bloggers.com/2021/02/fully-native-m1-apple-silicon-r-setup。从头开始重新安装可能会更快,而不是进行故障排除。
gfortran在/opt/R/arm64/bin中,我只需按照说明将其添加到路径中。
标签: r macos rcpp apple-m1 rcpparmadillo