From d4f0e66f08663b7021c274ab0e262501f897da1f Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 15 Jul 2026 16:58:02 +0500 Subject: [PATCH] build-all: fix issue on gcc 15 Error was: ``` configure: error: could not find a working compiler, see config.log for details ``` config.log: ``` conftest.c: In function 'f': conftest.c:12:48: error: too many arguments to function 'g'; expected 0, have 6 12 | for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}} | ^ ~ ``` --- nix/build-all.py | 9 +++++++++ nix/patches/gmp/001-fix-std23.patch | 27 +++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 nix/patches/gmp/001-fix-std23.patch diff --git a/nix/build-all.py b/nix/build-all.py index a606b2f750..e2d010be50 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -1246,6 +1246,14 @@ if "cgal" in targets: os.environ["CC"] = MAC_CROSS_COMPILE_INTEL_CC gmp_args.extend(MAC_CROSS_COMPILE_INTEL_AUTOCONF_HOST_ARGS) + # Fixes configure failing to find a working compiler under GCC 15's default -std=gnu23. + # Issue presumably will be resolved in any next gmp version, but currently the last one is 6.3.0. + # Patch is just applying fix from upstream meantion below: + # https://gmplib.org/list-archives/gmp-bugs/2025-February/005561.html + gmp_patches = ["./patches/gmp/001-fix-std23.patch"] + if GMP_VERSION != "6.3.0": + raise Exception(f"GMP_VERSION changed to {GMP_VERSION}, check whether {gmp_patches} is still needed.") + build_dependency( name=f"gmp-{GMP_VERSION}", mode="autoconf", @@ -1253,6 +1261,7 @@ if "cgal" in targets: pre_compile_subs=( [("build/config.h", "HAVE_OBSTACK_VPRINTF 1", "HAVE_OBSTACK_VPRINTF 0")] if "wasm" in flags else [] ), + patch=gmp_patches, # Sometimes ftp.gnu.org is very slow, use ftpmirror.gnu.org as a workaround. download_url="https://ftpmirror.gnu.org/gnu/gmp/", download_name=f"gmp-{GMP_VERSION}.tar.bz2", diff --git a/nix/patches/gmp/001-fix-std23.patch b/nix/patches/gmp/001-fix-std23.patch new file mode 100644 index 0000000000..738445f499 --- /dev/null +++ b/nix/patches/gmp/001-fix-std23.patch @@ -0,0 +1,27 @@ +Fixes configure failing to find a working compiler under GCC 15's default +-std=gnu23 (upstream fix: https://gmplib.org/repo/gmp/rev/8e7bb4ae7a18). + +Upstream fix is patching `acinclude.m4`, but since in the release tarball +all macros are already expanded to `configure` script, so we're patching +all occurrences of that macro. + +--- a/configure ++++ b/configure +@@ -6568,7 +6568,7 @@ + + #if defined (__GNUC__) && ! defined (__cplusplus) + typedef unsigned long long t1;typedef t1*t2; +-void g(){} ++void g(int,t1 const*,t1,t2,t1 const*,int){} + void h(){} + static __inline__ t1 e(t2 rp,t2 up,int n,t1 v0) + {t1 c,x,r;int i;if(v0){c=1;for(i=1;i