diff mbox series

[03/21] nettle: Fix build with GCC-15

Message ID 20250324-b4-musl-gcc15-v1-3-ca68c03c5b01@gmail.com
State Accepted, archived
Commit 2379010dfecffedc8d4253a03d5cb348f17ecee9
Headers show
Series musl/gcc-15: Fix packages to build with gcc15 on musl platforms | expand

Commit Message

Khem Raj March 24, 2025, 4:33 p.m. UTC
These signatures are exposed when build with musl particularly

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...-getopt-getenv-signatures-in-declarations.patch | 44 ++++++++++++++++++++++
 meta/recipes-support/nettle/nettle_3.10.1.bb       |  1 +
 2 files changed, 45 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-support/nettle/nettle/0001-getopt-Fix-getopt-getenv-signatures-in-declarations.patch b/meta/recipes-support/nettle/nettle/0001-getopt-Fix-getopt-getenv-signatures-in-declarations.patch
new file mode 100644
index 0000000000000000000000000000000000000000..c6f75e9150aa0108bfbc852784073f24c4245779
--- /dev/null
+++ b/meta/recipes-support/nettle/nettle/0001-getopt-Fix-getopt-getenv-signatures-in-declarations.patch
@@ -0,0 +1,44 @@ 
+From 20eb61eded3bf2ef03e1f37c8c1535b9c246d0f7 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 22 Mar 2025 13:48:29 -0700
+Subject: [PATCH] getopt: Fix getopt/getenv signatures in declarations
+
+GCC-15 complains about this when trying to build on musl
+
+| ../nettle-3.10.1/getopt.c:139:14: error: conflicting types for 'getenv'; have 'char *(void)'
+|   139 | extern char *getenv ();
+|       |              ^~~~~~
+
+Upstream-Status: Submitted [https://lists.lysator.liu.se/mailman/hyperkitty/list/nettle-bugs@lists.lysator.liu.se/thread/R6BDHRO44KSRDAOZQAREYICI2RG5PVNC/]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ getopt.c | 2 +-
+ getopt.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/getopt.c b/getopt.c
+index 9d29de7..5b89302 100644
+--- a/getopt.c
++++ b/getopt.c
+@@ -136,7 +136,7 @@ static struct _getopt_data getopt_data;
+    whose names are inconsistent.  */
+ 
+ #ifndef getenv
+-extern char *getenv ();
++extern char *getenv (const char *);
+ #endif
+ 
+ #endif /* not __GNU_LIBRARY__ */
+diff --git a/getopt.h b/getopt.h
+index da1a01f..ab50792 100644
+--- a/getopt.h
++++ b/getopt.h
+@@ -166,7 +166,7 @@ extern int __posix_getopt (int ___argc, char *const *___argv,
+ #  endif
+ # endif
+ #else /* not __GNU_LIBRARY__ */
+-extern int getopt ();
++extern int getopt(int, char * const [], const char *);
+ #endif /* __GNU_LIBRARY__ */
+ 
+ #ifndef __need_getopt
diff --git a/meta/recipes-support/nettle/nettle_3.10.1.bb b/meta/recipes-support/nettle/nettle_3.10.1.bb
index 85c470b10da41b3f0e1e0a6a241c415c273e9932..267a6ed44955c8bd648f0ff5d12f71406e279e1a 100644
--- a/meta/recipes-support/nettle/nettle_3.10.1.bb
+++ b/meta/recipes-support/nettle/nettle_3.10.1.bb
@@ -18,6 +18,7 @@  SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz \
            file://Add-target-to-only-build-tests-not-run-them.patch \
            file://run-ptest \
            file://check-header-files-of-openssl-only-if-enable_.patch \
+           file://0001-getopt-Fix-getopt-getenv-signatures-in-declarations.patch \
            "
 
 SRC_URI[sha256sum] = "b0fcdd7fc0cdea6e80dcf1dd85ba794af0d5b4a57e26397eee3bc193272d9132"