Add*_*dem 3 package-management compiling r
我有 R 版本 3.4.2,试图安装ggplot2,install.packages("ggplot2", dependencies = TRUE)在 RStudio 中运行。它最终告诉我它以非零退出状态退出并且错误很难阅读,因为消息太长,但我看到在这个过程中Matrix是一个也无法安装的依赖项,所以我尝试直接安装它,这是我在错误消息中看到的:
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'Matrix.so' failed
make: *** [Matrix.so] Error 1
ERROR: compilation failed for package ‘Matrix’
* removing ‘/usr/local/lib/R/site-library/Matrix’
Run Code Online (Sandbox Code Playgroud)
我不清楚到底ld是什么,以及我是否需要研究它来解决这个问题。看起来它可能交替与Matrix.so.
您需要为 R-package 安装这些构建依赖项:
sudo apt-get install r-base-dev
Run Code Online (Sandbox Code Playgroud)
然后将 R-packages 安装到您的主文件夹(即~/R/x86_64-pc-linux-gnu-library)。您不需要以root身份运行 RStudio 。