git2r
git2r copied to clipboard
Mention `make clean`?
I just recovered from a git2r setback and wonder if the README should include a reminder for people to consider doing make clean
or devtools::clean_dll()
.
For other work, I was installing/upgrading a bunch of stuff via homebrew, which caused an update of libssl. Which broke git2r.
So then I needed to update libssh2. And that caused an update of libgit2. You get the idea.
I was trying to use git2r and trying (and failing) to re-install it at various waypoints in the above journey. It felt like as soon as I succeeded in getting it to build against one of the updated dependencies, it was failing to build against another.
Example of the last cycle of this:
=> R CMD INSTALL --no-multiarch --with-keep.source git2r
* installing to library ‘/Users/jenny/Library/R/3.6/library’
* installing *source* package ‘git2r’ ...
** using staged installation
checking build system type... x86_64-apple-darwin18.7.0
checking host system type... x86_64-apple-darwin18.7.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for pkg-config... /usr/local/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
checking whether the libgit2 function git_buf_dispose is available... yes
checking whether the libgit2 constant GIT_OBJECT_ANY is available... yes
checking whether the libgit2 function git_error_last is available... yes
----- Results of the git2r package configure -----
PKG_CFLAGS: -I/usr/local/Cellar/libgit2/0.28.4/include -DGIT2R_HAVE_BUF_DISPOSE -DGIT2R_HAVE_OBJECT_ANY -DGIT2R_HAVE_GIT_ERROR
PKG_LIBS: -L/usr/local/Cellar/libgit2/0.28.4/lib -lgit2
--------------------------------------------------
configure: creating ./config.status
config.status: creating src/Makevars
** libs
make: Nothing to be done for `all'.
installing to /Users/jenny/Library/R/3.6/library/00LOCK-git2r/00new/git2r/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘git2r’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Users/jenny/Library/R/3.6/library/00LOCK-git2r/00new/git2r/libs/git2r.so':
dlopen(/Users/jenny/Library/R/3.6/library/00LOCK-git2r/00new/git2r/libs/git2r.so, 6): Library not loaded: /usr/local/opt/libgit2/lib/libgit2.27.dylib
Referenced from: /Users/jenny/Library/R/3.6/library/00LOCK-git2r/00new/git2r/libs/git2r.so
Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/jenny/Library/R/3.6/library/git2r’
* restoring previous ‘/Users/jenny/Library/R/3.6/library/git2r’
Exited with status 1.
On the surface, this is baffling. The config step finds the updated libgit2 (0.28):
----- Results of the git2r package configure -----
PKG_CFLAGS: -I/usr/local/Cellar/libgit2/0.28.4/include -DGIT2R_HAVE_BUF_DISPOSE -DGIT2R_HAVE_OBJECT_ANY -DGIT2R_HAVE_GIT_ERROR
PKG_LIBS: -L/usr/local/Cellar/libgit2/0.28.4/lib -lgit2
But installation fails because it can't find the old libgit2 (0.27):
Library not loaded: /usr/local/opt/libgit2/lib/libgit2.27.dylib
Referenced from: /Users/jenny/Library/R/3.6/library/00LOCK-git2r/00new/git2r/libs/git2r.so
Reason: image not found
If people are trying to install from local source, it would be good to remind them to do make clean
or devtools::clean_dll()
. There are threads here with installation struggles that, in hindsight, could be related to something as simple as this?