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] ---------------------------
    <stdin>: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/sbin:HOME/centos/usr/bin:HOME/centos/bin:PATH"

L='/lib:/lib64:/usr/lib:/usr/lib64'
export LD_LIBRARY_PATH="L: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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容