Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compilation failed with libgit2 1.8.0 #213

Closed
hengtseChou opened this issue May 9, 2024 · 10 comments
Closed

compilation failed with libgit2 1.8.0 #213

hengtseChou opened this issue May 9, 2024 · 10 comments

Comments

@hengtseChou
Copy link

I am running R on arch-based linux and cannot install the gert package. The error code is listed below. I am not sure is the r version or the compiler causing this issue, since I installed them successfully before. Thank you.

install.packages("gert")
* 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
Configuration OK!
** libs
using C compiler: ‘gcc (GCC) 14.1.1 20240507’
rm -f gert.so branch.o clone.o commit.o config.o conflicts.o files.o ignore.o init.o merge.o rebase.o stash.o submodules.o tag.o utils.o version.o
gcc -I"/usr/include/R/" -DNDEBUG -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/usr/local/include   -fvisibility=hidden -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c branch.c -o branch.o
gcc -I"/usr/include/R/" -DNDEBUG -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/usr/local/include   -fvisibility=hidden -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c clone.c -o clone.o
gcc -I"/usr/include/R/" -DNDEBUG -DR_NO_REMAP -DSTRICT_R_HEADERS  -I/usr/local/include   -fvisibility=hidden -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c commit.c -o commit.o
commit.c: In function ‘R_git_commit_create’:
commit.c:162:60: error: passing argument 10 of ‘git_commit_create’ from incompatible pointer type [-Wincompatible-pointer-types]
  162 |                             msg.ptr, tree, number_parents, parents), "git_commit_create");
      |                                                            ^~~~~~~
      |                                                            |
      |                                                            const git_commit **
In file included from /usr/include/git2/repository.h:14,
                 from /usr/include/git2/annotated_commit.h:11,
                 from /usr/include/git2.h:11,
                 from utils.h:1,
                 from commit.c:2:
/usr/include/git2/commit.h:369:28: note: expected ‘git_commit * const*’ but argument is of type ‘const git_commit **’
  369 |         git_commit * const parents[]);
      |         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~
make: *** [/usr/lib64/R/etc/Makeconf:195: commit.o] Error 1
ERROR: compilation failed for package ‘gert’
* removing ‘/home/hank/R/x86_64-pc-linux-gnu-library/4.4/gert’
Warning in install.packages :
  installation of package ‘gert’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/RtmpLu9S2U/downloaded_packages’
@hengtseChou
Copy link
Author

I did make sure that libgit2 is installed.

@jeroen
Copy link
Member

jeroen commented May 9, 2024

Thanks for the report. Which version of libgit2 is this?

I am guessing that gcc 14 (which was released a few days ago and already seems to be in archlinux) is using some stricter type checking, revealing a bug. I'll look into it asap.

@hengtseChou
Copy link
Author

Thanks for the quick response. The version of libgit2 is 1:1.8.0-2.

@jeroen
Copy link
Member

jeroen commented May 10, 2024

It looks like this is actually a break in libgit2 1.8.0: libgit2/libgit2#6793

This might explain why most distros (debian/homebrew/fedora) are staying with libgit2 1.7.2 for now. There are some discussions here: Homebrew/homebrew-core#166767 (comment)

As a temporary workaround you can try to uninstall the libgit2 from your machine, in which case gert will try to download a compatible libgit2 version at install time.

jeroen added a commit that referenced this issue May 10, 2024
git_commit is not const anymore. Fixes #213
@hengtseChou
Copy link
Author

I downgraded libgit2 to 1.7.2 and this time gert compiled with no issue. Thank you.

@jeroen jeroen changed the title compilation failed with R ver 4.4.0 compilation failed with libgit2 1.8.0 May 10, 2024
@ns-rse
Copy link

ns-rse commented May 23, 2024

I've encountered this issue too (also under Arch Linux) and downgrading to libgit-1.7.2 worked for me until recently when I needed to upgrade it since libgit is a dependency of other programmes on my system. I've encountered the same under Gentoo too (no surprise that this crops up on rolling release distros!).

It looks like a workaround is coming soon with #216 and release 2.0.2 which is great.

Thanks for all the hard work on this and other libraries, very much appreciated.

@chenrui333
Copy link

fyi, homebrew has shipped libgit2 1.8.0

@jeroen
Copy link
Member

jeroen commented Jul 18, 2024

Thanks. I have submitted an update for gert to CRAN, so it should be available soon.

@jeroen
Copy link
Member

jeroen commented Jul 19, 2024

A patch release gert 2.1.0 is now on CRAN.

@jeroen
Copy link
Member

jeroen commented Sep 25, 2024

Heads up that libgit2 may revert this again in 1.8.2: https://github.com/libgit2/libgit2/releases/tag/v1.8.2-rc1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants