配置找不到 libgit2 库
Configuration failed to find libgit2 library
尝试安装 R
devtools
软件包时(在 Linux Mint、19.3 和 R 4.0.2 上),我收到此错误。在 ANTICONF 部分,消息提供了一些关于我应该做什么的建议,但作为 Linux 的新手,我不明白如何执行指令,而且我在互联网上的搜索也没有结果。有人可以提供有关 commands/steps 我需要采取的安装 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
以下命令在 fedora 32 中对我有效
sudo yum install libgit2-devel
尝试安装 R
devtools
软件包时(在 Linux Mint、19.3 和 R 4.0.2 上),我收到此错误。在 ANTICONF 部分,消息提供了一些关于我应该做什么的建议,但作为 Linux 的新手,我不明白如何执行指令,而且我在互联网上的搜索也没有结果。有人可以提供有关 commands/steps 我需要采取的安装 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
以下命令在 fedora 32 中对我有效
sudo yum install libgit2-devel