git2r icon indicating copy to clipboard operation
git2r copied to clipboard

Failure to compile git2r on Ubuntu 24.04

Open wolass opened this issue 1 year ago • 1 comments

Hi, I dont know if this is related to the Issue #471 or not.

I em encountering problems when installing git2r from CRAN or from github.

Error: package or namespace load failed for ‘git2r’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/wolass/R/x86_64-pc-linux-gnu-library/4.3/00LOCK-git2r/00new/git2r/libs/git2r.so':
  libgit2.so.1.8: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted

I have installed lib2git (although could not find it on apt repos in ubuntu 24.04) from source using cmake.

The file that is reporting an error is acutally visible in the system.

❯ sudo find / | grep libgit2.so
/usr/lib/x86_64-linux-gnu/libgit2.so
/usr/local/lib/libgit2.so
/usr/local/lib/libgit2.so.1.8.3
/usr/local/lib/libgit2.so.1.8

wolass avatar Oct 28 '24 10:10 wolass

I had the same issue on Ubuntu 20.04.6 LTS.

To fix it:

  1. Copy libgit2 files and symbolic links:

    sudo cp -a /usr/local/lib/libgit2.so* /usr/lib/
    
  2. Copy the git2 include folder:

    sudo cp -r /usr/local/include/git2/ /usr/include/
    
  3. Try installing the gitr package again—it should work now.

erifa1 avatar Mar 25 '25 16:03 erifa1