r - 配置找不到 libgit2 库
问题描述
尝试安装R
devtools
软件包时(在 Linux Mint、19.3 和 R 4.0.2 上),我收到此错误。在 ANTICONF 部分,该消息为我应该做什么提供了一些建议,但作为 Linux 新手,我不明白如何执行这些指令,而且我在互联网上的搜索也没有结果。有人可以就安装libgit2
或解决此问题所需的命令/步骤提供指导吗?
> install.packages("devtools")
Installing package into ‘/home/xilliam/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
also installing the dependencies ‘gert’, ‘usethis’
trying URL 'https://cloud.r-project.org/src/contrib/gert_1.0.2.tar.gz'
Content type 'application/x-gzip' length 61324 bytes (59 KB)
==================================================
downloaded 59 KB
trying URL 'https://cloud.r-project.org/src/contrib/usethis_2.0.0.tar.gz'
Content type 'application/x-gzip' length 556740 bytes (543 KB)
==================================================
downloaded 543 KB
trying URL 'https://cloud.r-project.org/src/contrib/devtools_2.3.2.tar.gz'
Content type 'application/x-gzip' length 373387 bytes (364 KB)
==================================================
downloaded 364 KB
* installing *source* package ‘gert’ ...
** package ‘gert’ successfully unpacked and MD5 sums checked
** using staged installation
Using PKG_CFLAGS=
Using PKG_LIBS=-lgit2
----------------------------- ANTICONF -------------------------------
Configuration failed to find libgit2 library. Try installing:
* brew: libgit2 (MacOS)
* deb: libgit2-dev (Debian, Ubuntu, etc)
* rpm: libgit2-devel (Fedora, CentOS, RHEL)
If libgit2 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libgit2.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------- [ERROR MESSAGE] ---------------------------
<stdin>:1:10: fatal error: git2.h: No such file or directory
compilation terminated.
----------------------------------------------------------------------
ERROR: configuration failed for package ‘gert’
* removing ‘/home/xilliam/R/x86_64-pc-linux-gnu-library/4.0/gert’
Warning in install.packages :
installation of package ‘gert’ had non-zero exit status
ERROR: dependency ‘gert’ is not available for package ‘usethis’
* removing ‘/home/xilliam/R/x86_64-pc-linux-gnu-library/4.0/usethis’
Warning in install.packages :
installation of package ‘usethis’ had non-zero exit status
ERROR: dependency ‘usethis’ is not available for package ‘devtools’
* removing ‘/home/xilliam/R/x86_64-pc-linux-gnu-library/4.0/devtools’
Warning in install.packages :
installation of package ‘devtools’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpEHuYeP/downloaded_packages’
解决方案
Linux Mint 是基于 Debian 的,所以从终端,命令是:
sudo apt-get install libgit2-dev
推荐阅读
- google-apps-script - 谷歌表格插件,发布后无法正常工作
- powershell - Powershell Scope - 变量变为空白
- php - 如何以php形式更新动态选项
- python - 自定义类中的 Python 生成器
- python - Tf.keras model.predict() 返回大于 1 的类概率?
- unicode - 为什么贵宾犬和浴缸,而不是下标大写字母?(Julia 中的 Unicode)
- javascript - setState 和图标不能一起工作 - React Native
- angular - 根据Angular 9材料表中的值在一列中显示多个数据数组
- ubuntu-18.04 - WSL手动安装服务尚未启动
- php - 当我尝试使用 Facebook Graph API SDK 安排带有图像的帖子时返回未知错误