gpt4 book ai didi

r - 如何在 Apple Silicon (M1) Mac 上安装 RcppArmadillo

转载 作者:行者123 更新时间:2023-12-05 09:34:03 47 4
gpt4 key购买 nike

我一直在尝试许多不同的方法来安装 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 .

苹果版:

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 COMPILER TOOLS FOR RCPP ON MACOS
完成后,它给了我几乎与您在帖子中提到的相同的错误:

ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/.....'
ld: library not found for -lgfortran clang: error: linker command failed
with exit code 1 (use -v to see invocation)

看来,R 正在/opt/R/arm64 文件夹中寻找gfortran。
在教程中,它表明 gfortran 安装在 /usr/local/gfortran 文件夹中。
我在 /opt/R/arm64 中创建了一个符号链接(symbolic link),它使用命令
引用/usr/local/gfortranln -s/usr/local/gfortran/opt/R/arm64

关于r - 如何在 Apple Silicon (M1) Mac 上安装 RcppArmadillo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66817276/

47 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com