Unix 非 root 用户 R devtools installation error :Configuration failed to find libgit2 library

  • installing source package ‘gert’ ...
    ** package ‘gert’ successfully unpacked and MD5 sums checked
    ** using staged installation
    Found pkg-config cflags and libs!
    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] ---------------------------
    :1:18: fatal error: git2.h: No such file or directory
    compilation terminated.

ERROR: configuration failed for package ‘gert’

SOLVE:

  1. install libgit2
    unix非 root用户安装方法
    yum search libgit2-devel
    yumdownloader --destdir /ifs/scratch/..../rpm --resolve libgit2-devel.x86_64
    cd ~/centos && rpm2cpio /ifs/scratch/..../rpm/libgit2-devel-0.26.6-1.el7.x86_64.rpm | cpio -id

这里 下载-develop版本安装后只有链接而缺少 .so文件。解决方法是使用非 -develop版本。如下:

rpm2cpio http-parser-2.7.1-5.el7_4.x86_64.rpm | cpio -vid

2 更新环境变量
export PATH="HOME/centos/usr/bin:PATH"

L='/lib:/lib64:/usr/lib:/usr/lib64'
export LD_LIBRARY_PATH="HOME/centos/usr/lib:$HOME/centos/usr/lib64"

CPATH=/usr/local/include
export LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH=/usr/local/lib

reference:
https://stackoverflow.com/questions/36651091/how-to-install-packages-in-linux-centos-without-root-user-with-automatic-depen
https://www.jianshu.com/writer#/notebooks/48932807/notes/81463042https://www.cnblogs.com/zhming26/p/6164131.html
https://cran.curtin.edu.au/web/packages/Rcplex/INSTALL
https://github.com/libgit2/pygit2/issues/603

你可能感兴趣的:(Unix 非 root 用户 R devtools installation error :Configuration failed to find libgit2 library)