Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3] package/gmp: Fix for c23
@ 2025-04-24 22:49 Charlie Jenkins
  2025-05-07 20:23 ` Julien Olivain
  0 siblings, 1 reply; 3+ messages in thread
From: Charlie Jenkins @ 2025-04-24 22:49 UTC (permalink / raw)
  To: buildroot, Baruch Siach, Thomas Petazzoni; +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>
---
Changes in v3:
- Add signed-off-by to gmp patch
- Add comment pointing out patch requiring GMP_AUTORECONF
- Link to v2: https://lore.kernel.org/r/20250424-fix_gmp_c23-v2-1-a03fc808a87c@rivosinc.com

Changes in v2:
- Use autoreconf instead of patching configure
- Link to v1: https://lore.kernel.org/r/20250424-fix_gmp_c23-v1-1-b2474a9585b6@rivosinc.com
---
 ...m4-Add-parameter-names-in-prototype-for-g.patch | 57 ++++++++++++++++++++++
 package/gmp/gmp.mk                                 |  2 +
 2 files changed, 59 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..aaf3412c187f8cb8c307b8c3c0ec4b4324684836
--- /dev/null
+++ b/package/gmp/0001-acinclude.m4-Add-parameter-names-in-prototype-for-g.patch
@@ -0,0 +1,57 @@
+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>
+Signed-off-by: Charlie Jenkins <charlie@rivosinc.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/gmp.mk b/package/gmp/gmp.mk
index 7e8da9025c93b98b5820f297b6ea3549597395a5..790c70268e832d5f0217b4de734fa8ad97c45b84 100644
--- a/package/gmp/gmp.mk
+++ b/package/gmp/gmp.mk
@@ -7,6 +7,8 @@
 GMP_VERSION = 6.3.0
 GMP_SITE = $(BR2_GNU_MIRROR)/gmp
 GMP_SOURCE = gmp-$(GMP_VERSION).tar.xz
+# 0001-acinclude.m4-Add-parameter-names-in-prototype-for-g.patch
+GMP_AUTORECONF = YES
 GMP_INSTALL_STAGING = YES
 GMP_LICENSE = LGPL-3.0+ or GPL-2.0+
 GMP_LICENSE_FILES = COPYING.LESSERv3 COPYINGv2

---
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 v3] package/gmp: Fix for c23
  2025-04-24 22:49 [Buildroot] [PATCH v3] package/gmp: Fix for c23 Charlie Jenkins
@ 2025-05-07 20:23 ` Julien Olivain
  2025-05-07 21:04   ` Charlie Jenkins
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Olivain @ 2025-05-07 20:23 UTC (permalink / raw)
  To: Charlie Jenkins; +Cc: Thomas Petazzoni, buildroot

Hi Charlie,

On 25/04/2025 00:49, 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>

I'm sorry I missed your patch. I wrote an apply a similar one at:
https://gitlab.com/buildroot.org/buildroot/-/commit/31569bcc1b0762636d704baad0b35fc37aedb386
I'll mark it as "superseded".

On my side, my main motivation was to quickly fix host-gmp with gcc,
which was at that time generating a lot of build failures. I also
applied the fix for the target package.

Best regards,

Julien.
_______________________________________________
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 v3] package/gmp: Fix for c23
  2025-05-07 20:23 ` Julien Olivain
@ 2025-05-07 21:04   ` Charlie Jenkins
  0 siblings, 0 replies; 3+ messages in thread
From: Charlie Jenkins @ 2025-05-07 21:04 UTC (permalink / raw)
  To: Julien Olivain; +Cc: Thomas Petazzoni, buildroot

On Wed, May 07, 2025 at 10:23:24PM +0200, Julien Olivain wrote:
> Hi Charlie,
> 
> On 25/04/2025 00:49, 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>
> 
> I'm sorry I missed your patch. I wrote an apply a similar one at:
> https://gitlab.com/buildroot.org/buildroot/-/commit/31569bcc1b0762636d704baad0b35fc37aedb386
> I'll mark it as "superseded".
> 
> On my side, my main motivation was to quickly fix host-gmp with gcc,
> which was at that time generating a lot of build failures. I also
> applied the fix for the target package.

No worries, thank you!

- Charlie

> 
> Best regards,
> 
> Julien.
_______________________________________________
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-05-07 21:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24 22:49 [Buildroot] [PATCH v3] package/gmp: Fix for c23 Charlie Jenkins
2025-05-07 20:23 ` Julien Olivain
2025-05-07 21:04   ` Charlie Jenkins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox