Fix building with GCC 15 (#9643)

* Patch GMP to build on GCC15

* Add cstdint include - GCC15 defaults to C23

* Update GMP PATCH_COMMAND to work without a valid git repo

* Set GMP_DIRECTORY_FLAG
This commit is contained in:
Maciej Lisiewski 2025-05-16 17:48:59 +02:00 committed by GitHub
parent 9110dd51dc
commit 2490564f7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 44 additions and 6 deletions

32
deps/GMP/0001-GMP_GCC15.patch vendored Normal file
View File

@ -0,0 +1,32 @@
--- GMP/acinclude.m4 2025-05-14 18:50:11.396354745 -0400
+++ GMP/acinclude.m4.2 2025-05-14 18:57:20.757853503 -0400
@@ -609,7 +609,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<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}
--- GMP/configure 2025-05-14 19:33:35.730593315 -0400
+++ GMP/configure 2025-05-14 19:35:37.805619186 -0400
@@ -6526,7 +6526,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<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}
@@ -8145,7 +8145,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<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}

5
deps/GMP/GMP.cmake vendored
View File

@ -1,6 +1,10 @@
set(_srcdir ${CMAKE_CURRENT_LIST_DIR}/gmp)
if (IN_GIT_REPO)
set(GMP_DIRECTORY_FLAG --directory ${BINARY_DIR_REL}/dep_GMP-prefix/src/dep_GMP)
endif ()
if (MSVC)
set(_output ${DESTDIR}/include/gmp.h
${DESTDIR}/lib/libgmp-10.lib
@ -59,6 +63,7 @@ else ()
URL https://github.com/SoftFever/OrcaSlicer_deps/releases/download/gmp-6.2.1/gmp-6.2.1.tar.bz2
URL_HASH SHA256=eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/GMP
PATCH_COMMAND git apply ${GMP_DIRECTORY_FLAG} --verbose ${CMAKE_CURRENT_LIST_DIR}/0001-GMP_GCC15.patch
BUILD_IN_SOURCE ON
CONFIGURE_COMMAND env "CFLAGS=${_gmp_ccflags}" "CXXFLAGS=${_gmp_ccflags}" ./configure ${_cross_compile_arg} --enable-shared=no --enable-cxx=yes --enable-static=yes "--prefix=${DESTDIR}" ${_gmp_build_tgt}
BUILD_COMMAND make -j

View File

@ -24,6 +24,7 @@
#include <algorithm> // std::sort
#include <cstdlib>
#include <tuple> // std::make_tuple std::get<>
#include <cstdint>
double square_root(const double& number)