Configuration failed to find libgit2 library

江枫思渺然 提交于 2021-02-19 07:34:19

问题


When attempting to install the R devtoolspackage (on Linux Mint, 19.3 & R 4.0.2),I receive this error. In the ANTICONF section the message offers some suggestions for what I should do, but being new to Linux I don't understand how to implement the instructions, and my search of the internet has not yielded fruit. Could someone offer guidance on the commands/steps I need to take to install libgit2 or resolve this issue?

> 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’

回答1:


Linux Mint is Debian-based so from a terminal, the command is:

sudo apt-get install libgit2-dev



回答2:


The following command worked for me in fedora 32

sudo yum install libgit2-devel


来源:https://stackoverflow.com/questions/65433724/configuration-failed-to-find-libgit2-library

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!