diff --git a/nix/build-all.py b/nix/build-all.py index 6c8dfa51a8..c83ffb0f4c 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -1171,6 +1171,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", @@ -1178,6 +1186,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