编译 RcppArmadillo 时遇到问题 - 未找到库 gfortran
Posted
技术标签:
【中文标题】编译 RcppArmadillo 时遇到问题 - 未找到库 gfortran【英文标题】:Having an issue with compiling RcppArmadillo - library gfortran not found 【发布时间】:2019-03-09 02:25:16 【问题描述】:跑步:
install.packages("RcppArmadillo")
我收到以下错误:
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
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/3.5/Resources/library/RcppArmadillo’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppArmadillo’
The downloaded source packages are in
‘/private/var/folders/x8/mrn18h_50g78zbq2jrxcwkx00000gn/T/RtmpK4nz32/downloaded_packages’
Warning messages:
1: In install.packages(update[instlib == l, "Package"], l, repos = repos, :
installation of package ‘coin’ had non-zero exit status
2: In install.packages(update[instlib == l, "Package"], l, repos = repos, :
installation of package ‘Matrix’ had non-zero exit status
3: In install.packages(update[instlib == l, "Package"], l, repos = repos, :
installation of package ‘RcppArmadillo’ had non-zero exit status
所以它毕竟没有安装它。我在此链接上阅读了cannot compile RcppArmadillo in R,但我无法解决问题,因为我不明白该怎么做。能不能给点意见?
我什至尝试过这样做
install.packages("https://cran.r-project.org/src/contrib/Archive/RcppArmadillo/RcppArmadillo_0.6.100.0.0.tar.gz", repos=NULL, type="source")
出现同样的错误
感谢 JPR,我找到了帮助我解决问题的答案。所以如果你用linux,就用他的命令行,如果你用Mac,就按照这个帖子安装运行库
OS X package installation depends on gfortran-4.8
【问题讨论】:
【参考方案1】:您的机器上缺少运行时库。试试看
sudo apt-get install libgfortan5 libgfortan-8-dev
【讨论】:
我使用的是 Mac 而不是 linux以上是关于编译 RcppArmadillo 时遇到问题 - 未找到库 gfortran的主要内容,如果未能解决你的问题,请参考以下文章
在 R 中使用 RcppArmadillo 包和 rowvec 时出现编译错误
错误:R 3.5.3 上的 RcppArmadillo 包延迟加载失败
错误:R 3.5.3上的程序包RcppArmadillo的延迟加载失败