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

Build failure with GCC-14: incompatible pointer types #127

Closed
NHOrus opened this issue May 11, 2024 · 7 comments
Closed

Build failure with GCC-14: incompatible pointer types #127

NHOrus opened this issue May 11, 2024 · 7 comments
Labels
wontfix This will not be worked on

Comments

@NHOrus
Copy link

NHOrus commented May 11, 2024

GCC-14 is enabling by default errors on long-deprecated features of C.
This caused a build failure due to const pointers pitfails.

/usr/bin/x86_64-pc-linux-gnu-gcc -Degit2_EXPORTS -isystem /include  -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -std=gnu99 -fPIC -Wall -Wextra -MD -MT src/CMakeFiles/egit2.dir/egit-commit.c.o -MF src/CMakeFiles/egit2.dir/egit-commit.c.o.d -o src/CMakeFiles/egit2.dir/egit-commit.c.o -c /var/tmp/portage/app-emacs/libegit2-0.0.20230129/work/libegit2-ab1a53a6a0120872e42582fc980e779d47de6d0e/src/egit-commit.c
/var/tmp/portage/app-emacs/libegit2-0.0.20230129/work/libegit2-ab1a53a6a0120872e42582fc980e779d47de6d0e/src/egit-commit.c: In function ‘egit_commit_create’:
/var/tmp/portage/app-emacs/libegit2-0.0.20230129/work/libegit2-ab1a53a6a0120872e42582fc980e779d47de6d0e/src/egit-commit.c:258:103: error: passing argument 10 of ‘git_commit_create’ from incompatible pointer type [-Wincompatible-pointer-types]
  258 |     int retval = git_commit_create(&oid, repo, refname, author, committer, NULL, msg, tree, nparents, parents);
      |                                                                                                       ^~~~~~~
      |                                                                                                       |
      |                                                                                                       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 /var/tmp/portage/app-emacs/libegit2-0.0.20230129/work/libegit2-ab1a53a6a0120872e42582fc980e779d47de6d0e/src/egit-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[]);
      |         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~

Gentoo bug https://bugs.gentoo.org/928920

@tarsius
Copy link
Member

tarsius commented May 15, 2024

Could you please propose a pull-request? I am not a C programmer and don't use this package.

By the way, what does Gentoo use this package for? Magit doesn't use it for anything but a very basic proof-of-concept. That poc will be removed in the next release (not least so packagers are not mislead into believing they have to package this module).

@NHOrus
Copy link
Author

NHOrus commented May 16, 2024

Well, only Magit. Thanks for info, frankly
https://github.com/magit/libegit2/blob/373defaad0da3941f59fe704c010a8e0c793d7be/src/egit-commit.c#L243
Change
const git_commit *parents[nparents]; to git_commit *const parents[nparents]; to get it to satisfy the type

@NHOrus
Copy link
Author

NHOrus commented May 16, 2024

But I can't replicate it building from master!

@NHOrus
Copy link
Author

NHOrus commented May 16, 2024

Okay, because master builds from libgit-v1.0.0 and in Gentoo it's build from libgit-v1.8.0

@tarsius
Copy link
Member

tarsius commented May 16, 2024

Magit does not depend on this package. This repository unfortunately has turned out to be a "gift of work" and this inquiry has reminded me that I have to put in some more work now, to hopefully reduce future work.

At the time the previous Magit release was cut, the Magit repository still contained some completely useless code that merely demonstrate that technically it was feasible to implement multiple "backends".

Because of its uselessness, this magit-libgit.el library was not shipped with the Magit package on MELPA. Other distributors should have done the same. I believe Gentoo is not the only one who ships it anyway, which is why I have taken further steps to discourage doing that.

The last of these steps was magit/magit@c9fd812, two weeks ago. I am now going to remove magit-libgit.el altogether, and to move this repository to https://github.com/emacsorphanage, so that there can no longer be any doubt about the status of this repository and Magit's non-use of libgit2.

The ebuilds should be modified like so:

  1. Remove lisp/magit-libgit.el after unpacking the tarball, until that becomes unnecessary.
  2. Remove this package from app-emacs/magit's dependency list.

In the case of app-emacs/magit-3.3.0.50* some additional changes may have to be backported. If it is still possible to build that package, then you might want hold of a few more weeks, as I plan to create a new Magit release within the next few weeks.

Please forward this suggestion to the maintainers of the Gentoo package.

I'll post an update on magit/magit#2959 some time after completing the removal of the stub library and this repository.

@tarsius tarsius added the wontfix This will not be worked on label May 16, 2024
gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue May 19, 2024
@xgqt
Copy link

xgqt commented May 19, 2024

I dropped libegit form stable magit & added a new master snapshot (so unstable users can just "roll on").

@tarsius
Copy link
Member

tarsius commented May 20, 2024

Great, thanks!

@tarsius tarsius closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Development

No branches or pull requests

3 participants