Not able to install git2r

Hi,

Has anyone had this issue with installing git2r on RHEL 8? I have libgit2-devel already installed. Thank you.

'install.packages("./git2r_0.35.0.tar.gz", type="source", configure.vars="LIB_DIR=-L/usr/lib64 INCLUDE_DIR=-I/usr/include")'
inferring 'repos = NULL' from 'pkgs'

  • installing source package ‘git2r’ ...
    ** package ‘git2r’ successfully unpacked and MD5 sums checked
    ** using staged installation
    checking build system type... x86_64-pc-linux-gnu
    checking host system type... x86_64-pc-linux-gnu
    checking for pkg-config... /bin/pkg-config
    checking pkg-config is at least version 0.9.0... yes
    Found INCLUDE_DIR and/or LIB_DIR!
    checking whether the libgit2 version will work in git2r... no


    Configuration failed to find libgit2 library. Try installing:

    • brew: libgit2 (MacOS)
    • deb: libgit2-dev (Debian, Ubuntu, etc)
    • rpm: libgit2-devel (Fedora, CentOS, RHEL)
      and try again.

    If the libgit2 library is installed on your system but the git2r
    configuration is unable to find it, you can specify the include and
    lib path to libgit2 with:

    given you downloaded a tar-gz archive:
    R CMD INSTALL git2r-.tar.gz --configure-vars='INCLUDE_DIR=/path/to/include LIB_DIR=/path/to/lib'

    or cloned the GitHub git2r repository into a directory:
    R CMD INSTALL git2r/ --configure-vars='INCLUDE_DIR=/path/to/include LIB_DIR=/path/to/lib'

    or download and install git2r in R using
    install.packages('git2r', type='source', configure.vars='LIB_DIR=-L/path/to/libs INCLUDE_DIR=-I/path/to/headers')


configure: error: in '/tmp/Rtmpyj1je2/R.INSTALL25c4e746d89c9d/git2r':
configure: error: package dependency requirement 'libgit2 >= 1.0' could not be satisfied.
See 'config.log' for more details
ERROR: configuration failed for package ‘git2r’

  • removing ‘/opt/R/4.3.1/lib/R/library/git2r’
    Warning message:
    In install.packages("/home/adm.rstudio/git2r_0.35.0.tar.gz", type = "source", :
    installation of package ‘/home/adm.rstudio/git2r_0.35.0.tar.gz’ had non-zero exit status

You are missing this system dependency, try installing it with this command from a system terminal

yum install libgit2-devel

Possibly you need a newer version of libgit2-devel, AFAIR you can install one from EPEL.

Also, try to make your install.packages() command as simple as possible, it is not necessary to set LIB_DIR and INCLUDE_DIR unless you run into some issues. Even worse, setting LIB_DIR and INCLUDE_DIR will prevent pkg-config to figure out where the libraries and header files are located...

I'd try and run

install.packages("./git2r_0.35.0.tar.gz", type="source") 

and see if this works (provided you have downloaded git2r_0.35.0.tar.gzinto the current folder). If you system allows direct download of packages from CRAN, I would even go as far and simply run install.packages("git2r").

I definitely can confirm that on RHEL8 with the provided libgit2-devel package I am able to successfully install git2r from source:

> install.packages("git2r")
trying URL 'https://stat.ethz.ch/CRAN/src/contrib/git2r_0.35.0.tar.gz'
Content type 'application/x-gzip' length 236583 bytes (231 KB)
==================================================
downloaded 231 KB

* installing *source* package ‘git2r’ ...
** package ‘git2r’ successfully unpacked and MD5 sums checked
** using staged installation
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
Found pkg-config cflags and libs!
checking whether the libgit2 version will work in git2r... yes
----- Results of the git2r package configure -----

  PKG_CFLAGS: 
  PKG_LIBS: -lgit2 

--------------------------------------------------
configure: creating ./config.status
...

Thanks, but I've already done that as I mentioned in my post

I tried that as well. Same error

Thanks! I'll give that a try.

This issue is resolved by installing a newer version of libgit2-devel from EPEL. Thanks, all!

1 Like