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

[gcc-15] ../.../blst.h: error: two or more data types in declaration specifiers #240

Closed
SamWilsn opened this issue Nov 19, 2024 · 8 comments

Comments

@SamWilsn
Copy link

Don't know if it's relevant, but this system used gcc 15.

# github.com/supranational/blst/bindings/go
In file included from ../go-mod/github.com/supranational/[email protected]/bindings/go/blst.go:18:
../go-mod/github.com/supranational/[email protected]/bindings/go/../blst.h:27:15: error: two or more data types in declaration specifiers
   27 | typedef _Bool bool; /* it's assumed that cgo calls modern enough compiler */
      |               ^~~~

typedef _Bool bool; /* it's assumed that cgo calls modern enough compiler */

For a lot more detail, including build logs and system details, see: https://bugs.gentoo.org/943964

@dot-asm
Copy link
Collaborator

dot-asm commented Nov 19, 2024

It appears that gcc>=14 fails if it's instructed with -std=c2x. Would it be correct assumption that gcc-15 (or your installation) defaults to [non-finalized] c2x? Even newer clang complains about C++ type redeclaration. WTF? It's a C++ type, and we're compiling C! Neither seems to be fair :-) But that's life... I'll look into it, meanwhile you have to find a way to instruct your compiler to stick to -std=<less-than-c2x>...

@SamWilsn
Copy link
Author

I'm using it through your go bindings (specifically as a dependency of geth.) Can I pass cflags through there?

@dot-asm
Copy link
Collaborator

dot-asm commented Nov 20, 2024

Can I pass cflags through there?

CGO_CFLAGS environment variable controls the C compiler flags in cgo context, but one has to recognize that it's "non-cumulative," i.e. if you set it, you have to set all the relevant flags, most notably -O2. See go env CGO_CFLAGS for your defaults. At the same time you have to keep in mind that if you rely on some build script and it sets the variable in question, it will simply override yours.

@SamWilsn
Copy link
Author

Looks like C23 is actually finished as of Oct. 31, and GCC defaults to it now. bool is a real C type 🎉

@dot-asm
Copy link
Collaborator

dot-asm commented Nov 20, 2024

Well, it's still not fair :-) The standard says the new __STDC_VERSION__ is 202311L, so one shouldn't expect things to break with __STDC_VERSION__ 202000L, which is the value set by gcc<=14 -std=c2x. Yet it's only gcc>=14 that fails. What does your compiler set? In other words what does gcc -dM -E -x c /dev/null | grep __STDC_VERSION__ print?

@SamWilsn
Copy link
Author

gentoo-chroot ~ # gcc-15 -dM -E -x c /dev/null | grep __STDC_VERSION__
#define __STDC_VERSION__ 202311L

@dot-asm
Copy link
Collaborator

dot-asm commented Nov 22, 2024

I'm not sure that they will keep C23 as default in the final release, but the report was very useful anyway. Thanks!

@SamWilsn
Copy link
Author

Thanks a ton! Do you happen to know roughly when this'll make it into a release?

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

No branches or pull requests

2 participants