]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
which: Fix build with gcc-15 on musl
authorKhem Raj <raj.khem@gmail.com>
Mon, 24 Mar 2025 16:33:28 +0000 (09:33 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 26 Mar 2025 18:45:14 +0000 (18:45 +0000)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-extended/which/which-2.21/0001-getopt-Fix-signature-of-getenv-function.patch [new file with mode: 0644]
meta/recipes-extended/which/which_2.21.bb

diff --git a/meta/recipes-extended/which/which-2.21/0001-getopt-Fix-signature-of-getenv-function.patch b/meta/recipes-extended/which/which-2.21/0001-getopt-Fix-signature-of-getenv-function.patch
new file mode 100644 (file)
index 0000000..e006d79
--- /dev/null
@@ -0,0 +1,39 @@
+From 16a1647fc26953fab659de5f55d4c0defdfb894f Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 22 Mar 2025 17:56:19 -0700
+Subject: [PATCH] getopt: Fix signature of getenv function
+
+This happens on musl systems using GCC 15
+
+../which-2.21/getopt.h:106:12: error: conflicting types for 'getopt'; have 'int(void)'
+  106 | extern int getopt ();
+      |            ^~~~~~
+
+Upstream-Status: Submitted [https://lists.gnu.org/archive/html/which-bugs/2025-03/msg00000.html]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ getopt.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/getopt.c
++++ b/getopt.c
+@@ -209,7 +209,7 @@ static char *posixly_correct;
+ /* Avoid depending on library functions or files
+    whose names are inconsistent.  */
+-char *getenv ();
++char *getenv (const char*);
+ static char *
+ my_index (str, chr)
+--- a/getopt.h
++++ b/getopt.h
+@@ -103,7 +103,7 @@ struct option
+    errors, only prototype getopt for the GNU C library.  */
+ extern int getopt (int argc, char *const *argv, const char *shortopts);
+ #else /* not __GNU_LIBRARY__ */
+-extern int getopt ();
++extern int getopt (int, char * const [], const char *);
+ #endif /* __GNU_LIBRARY__ */
+ extern int getopt_long (int argc, char *const *argv, const char *shortopts,
+                       const struct option *longopts, int *longind);
index a8cb45f8fce876bbb6d710bc0cb37ab9af87869d..6e855bca3feb2f0bf35f4c7de42638fb75281180 100644 (file)
@@ -18,6 +18,7 @@ EXTRA_OECONF = "--disable-iberty"
 
 SRC_URI = "${GNU_MIRROR}/which/which-${PV}.tar.gz \
            file://automake.patch \
+           file://0001-getopt-Fix-signature-of-getenv-function.patch \
            "
 
 SRC_URI[sha256sum] = "f4a245b94124b377d8b49646bf421f9155d36aa7614b6ebf83705d3ffc76eaad"