r - 编译 RcppArmadillo 时遇到问题 - 未找到库 gfortran
问题描述
跑步:
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
所以它毕竟没有安装它。我在此链接上阅读了无法在 R 中编译 RcppArmadillo但我无法解决此问题,因为我不明白该怎么做。你能请评论吗?
我什至试图这样做
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,按照这个帖子安装运行时库
解决方案
您的机器上缺少运行时库。只需尝试
sudo apt-get install libgfortan5 libgfortan-8-dev
推荐阅读
- php - 我如何在laravel中更新多个图像
- python - 在 wxPython 的 html 窗口中更改字体大小
- spring-boot-test - 如何隔离运行 Spring Boot 集成测试?
- xml - PowerShell:对自定义的 pscustomobject 进行排序
- algorithm - 如下所示,背包问题如何将这些重量放入一个 theif 袋中
- c# - 引用的对象为空 - HTTPPostedFiles
- rx-java - RxJava2 - 间隔和调度器
- java - 在回收站视图上创建点,如查看寻呼机
- sql-server - Nvarchar 在存储过程中显示为问号
- echarts - 绘制两条线时echarts折线图扭曲