* [Buildroot] [PATCH] package/gmp: Fix for c23
@ 2025-04-24 7:29 Charlie Jenkins
2025-04-24 8:01 ` Baruch Siach via buildroot
0 siblings, 1 reply; 3+ messages in thread
From: Charlie Jenkins @ 2025-04-24 7:29 UTC (permalink / raw)
To: buildroot; +Cc: Charlie Jenkins
GMP will not build for a C compiler configured for c23 because its
autoconf scripts use deprecated function prototypes. Include an upstream
patch that fixes this issue.
Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
---
...m4-Add-parameter-names-in-prototype-for-g.patch | 56 ++++++++++++++++++++++
...atch-configure-script-for-c23-function-pr.patch | 39 +++++++++++++++
2 files changed, 95 insertions(+)
diff --git a/package/gmp/0001-acinclude.m4-Add-parameter-names-in-prototype-for-g.patch b/package/gmp/0001-acinclude.m4-Add-parameter-names-in-prototype-for-g.patch
new file mode 100644
index 0000000000000000000000000000000000000000..339718888d0e1dd6bf0c3601632fceee4eff5f81
--- /dev/null
+++ b/package/gmp/0001-acinclude.m4-Add-parameter-names-in-prototype-for-g.patch
@@ -0,0 +1,56 @@
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 15 Mar 2025 17:58:40 +0100
+Subject: [PATCH] acinclude.m4: Add parameter names in prototype for g().
+
+This allows it to compile with older gcc e.g. gcc-10
+which does not have allow parameter name omission, it results
+in
+
+a.c: In function ‘g’:
+a.c:3:8: error: parameter name omitted
+ 3 | void g(int,t1 const*,t1,t2,t1 const*,int){}
+ | ^~~
+
+this was added to gcc via [1] thats why it is supported in
+newer gcc.
+
+Adding the parameter names make it compatible with
+old and new gcc
+
+[1] https://gcc.gnu.org/pipermail/gcc-cvs/2020-October/336068.html
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+Upstream: https://gmplib.org/list-archives/gmp-devel/2025-March/006294.html
+---
+ ChangeLog | 4 ++++
+ acinclude.m4 | 2 +-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 2902cd2..df42076 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2025-03-15 Khem Raj <raj.khem at gmail.com>
++
++ * acinclude.m4: Add parameter names to function prototype.
++
+ 2023-07-29 Torbjörn Granlund <tg@gmplib.org>
+
+ * Version 6.3.0 released.
+diff --git a/acinclude.m4 b/acinclude.m4
+index 9cf9483..1fd0d4f 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -609,7 +609,7 @@ GMP_PROG_CC_WORKS_PART([$1], [long long reliability test 1],
+
+ #if defined (__GNUC__) && ! defined (__cplusplus)
+ typedef unsigned long long t1;typedef t1*t2;
+-void g(){}
++void g(int a,t1 const* b,t1 c,t2 d,t1 const* e,int f){}
+ 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;}
+--
+2.43.0
+
diff --git a/package/gmp/0002-configure-Patch-configure-script-for-c23-function-pr.patch b/package/gmp/0002-configure-Patch-configure-script-for-c23-function-pr.patch
new file mode 100644
index 0000000000000000000000000000000000000000..d60c4d39f670d8c4f9dc937b14659695e3cc36a3
--- /dev/null
+++ b/package/gmp/0002-configure-Patch-configure-script-for-c23-function-pr.patch
@@ -0,0 +1,39 @@
+From: Charlie Jenkins <charlie@rivosinc.com>
+Date: Wed, 23 Apr 2025 23:55:25 -0700
+Subject: [PATCH] configure: Patch configure script for c23 function prototype
+
+The distributed configure script is pre-generated so it will not be
+updated by acinclude.m4. Patch the configure script to allow gmp to
+compile with c23.
+
+Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
+Upstream: N/A (patching generated autoconf files)
+---
+ configure | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure b/configure
+index 7910aa0..259f7c8 100755
+--- a/configure
++++ b/configure
+@@ -6568,7 +6568,7 @@ if test "$gmp_prog_cc_works" = yes; then
+
+ #if defined (__GNUC__) && ! defined (__cplusplus)
+ typedef unsigned long long t1;typedef t1*t2;
+-void g(){}
++void g(int a,t1 const* b,t1 c,t2 d,t1 const* e,int f){}
+ 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;}
+@@ -8187,7 +8187,7 @@ if test "$gmp_prog_cc_works" = yes; then
+
+ #if defined (__GNUC__) && ! defined (__cplusplus)
+ typedef unsigned long long t1;typedef t1*t2;
+-void g(){}
++void g(int a,t1 const* b,t1 c,t2 d,t1 const* e,int f){}
+ 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;}
+--
+2.43.0
+
---
base-commit: 1fc51abc27d37c2874823ab864db0f32ae774eb6
change-id: 20250424-fix_gmp_c23-c374e940b045
--
- Charlie
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Buildroot] [PATCH] package/gmp: Fix for c23
2025-04-24 7:29 [Buildroot] [PATCH] package/gmp: Fix for c23 Charlie Jenkins
@ 2025-04-24 8:01 ` Baruch Siach via buildroot
2025-04-24 19:15 ` Charlie Jenkins
0 siblings, 1 reply; 3+ messages in thread
From: Baruch Siach via buildroot @ 2025-04-24 8:01 UTC (permalink / raw)
To: Charlie Jenkins; +Cc: buildroot
Hi Charlie,
On Thu, Apr 24 2025, Charlie Jenkins wrote:
> GMP will not build for a C compiler configured for c23 because its
> autoconf scripts use deprecated function prototypes. Include an upstream
> patch that fixes this issue.
>
> Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> ---
[...]
> diff --git
> a/package/gmp/0002-configure-Patch-configure-script-for-c23-function-pr.patch
> b/package/gmp/0002-configure-Patch-configure-script-for-c23-function-pr.patch
> new file mode 100644
> index 0000000000000000000000000000000000000000..d60c4d39f670d8c4f9dc937b14659695e3cc36a3
> --- /dev/null
> +++ b/package/gmp/0002-configure-Patch-configure-script-for-c23-function-pr.patch
> @@ -0,0 +1,39 @@
> +From: Charlie Jenkins <charlie@rivosinc.com>
> +Date: Wed, 23 Apr 2025 23:55:25 -0700
> +Subject: [PATCH] configure: Patch configure script for c23 function prototype
> +
> +The distributed configure script is pre-generated so it will not be
> +updated by acinclude.m4. Patch the configure script to allow gmp to
> +compile with c23.
> +
> +Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> +Upstream: N/A (patching generated autoconf files)
When patching autoconf source files we usually add PKG_AUTORECONF to
regenerate the configure script at build time. This patch should not be
needed then.
baruch
> +---
> + configure | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/configure b/configure
> +index 7910aa0..259f7c8 100755
> +--- a/configure
> ++++ b/configure
> +@@ -6568,7 +6568,7 @@ if test "$gmp_prog_cc_works" = yes; then
> +
> + #if defined (__GNUC__) && ! defined (__cplusplus)
> + typedef unsigned long long t1;typedef t1*t2;
> +-void g(){}
> ++void g(int a,t1 const* b,t1 c,t2 d,t1 const* e,int f){}
> + 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;}
> +@@ -8187,7 +8187,7 @@ if test "$gmp_prog_cc_works" = yes; then
> +
> + #if defined (__GNUC__) && ! defined (__cplusplus)
> + typedef unsigned long long t1;typedef t1*t2;
> +-void g(){}
> ++void g(int a,t1 const* b,t1 c,t2 d,t1 const* e,int f){}
> + 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;}
> +--
> +2.43.0
> +
>
> ---
> base-commit: 1fc51abc27d37c2874823ab864db0f32ae774eb6
> change-id: 20250424-fix_gmp_c23-c374e940b045
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Buildroot] [PATCH] package/gmp: Fix for c23
2025-04-24 8:01 ` Baruch Siach via buildroot
@ 2025-04-24 19:15 ` Charlie Jenkins
0 siblings, 0 replies; 3+ messages in thread
From: Charlie Jenkins @ 2025-04-24 19:15 UTC (permalink / raw)
To: Baruch Siach; +Cc: buildroot
On Thu, Apr 24, 2025 at 11:01:15AM +0300, Baruch Siach wrote:
> Hi Charlie,
>
> On Thu, Apr 24 2025, Charlie Jenkins wrote:
> > GMP will not build for a C compiler configured for c23 because its
> > autoconf scripts use deprecated function prototypes. Include an upstream
> > patch that fixes this issue.
> >
> > Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> > ---
>
> [...]
>
> > diff --git
> > a/package/gmp/0002-configure-Patch-configure-script-for-c23-function-pr.patch
> > b/package/gmp/0002-configure-Patch-configure-script-for-c23-function-pr.patch
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..d60c4d39f670d8c4f9dc937b14659695e3cc36a3
> > --- /dev/null
> > +++ b/package/gmp/0002-configure-Patch-configure-script-for-c23-function-pr.patch
> > @@ -0,0 +1,39 @@
> > +From: Charlie Jenkins <charlie@rivosinc.com>
> > +Date: Wed, 23 Apr 2025 23:55:25 -0700
> > +Subject: [PATCH] configure: Patch configure script for c23 function prototype
> > +
> > +The distributed configure script is pre-generated so it will not be
> > +updated by acinclude.m4. Patch the configure script to allow gmp to
> > +compile with c23.
> > +
> > +Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
> > +Upstream: N/A (patching generated autoconf files)
>
> When patching autoconf source files we usually add PKG_AUTORECONF to
> regenerate the configure script at build time. This patch should not be
> needed then.
That's much better, thank you! :)
- Charlie
>
> baruch
>
> > +---
> > + configure | 4 ++--
> > + 1 file changed, 2 insertions(+), 2 deletions(-)
> > +
> > +diff --git a/configure b/configure
> > +index 7910aa0..259f7c8 100755
> > +--- a/configure
> > ++++ b/configure
> > +@@ -6568,7 +6568,7 @@ if test "$gmp_prog_cc_works" = yes; then
> > +
> > + #if defined (__GNUC__) && ! defined (__cplusplus)
> > + typedef unsigned long long t1;typedef t1*t2;
> > +-void g(){}
> > ++void g(int a,t1 const* b,t1 c,t2 d,t1 const* e,int f){}
> > + 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;}
> > +@@ -8187,7 +8187,7 @@ if test "$gmp_prog_cc_works" = yes; then
> > +
> > + #if defined (__GNUC__) && ! defined (__cplusplus)
> > + typedef unsigned long long t1;typedef t1*t2;
> > +-void g(){}
> > ++void g(int a,t1 const* b,t1 c,t2 d,t1 const* e,int f){}
> > + 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;}
> > +--
> > +2.43.0
> > +
> >
> > ---
> > base-commit: 1fc51abc27d37c2874823ab864db0f32ae774eb6
> > change-id: 20250424-fix_gmp_c23-c374e940b045
>
> --
> ~. .~ Tk Open Systems
> =}------------------------------------------------ooO--U--Ooo------------{=
> - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-24 19:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24 7:29 [Buildroot] [PATCH] package/gmp: Fix for c23 Charlie Jenkins
2025-04-24 8:01 ` Baruch Siach via buildroot
2025-04-24 19:15 ` Charlie Jenkins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox