package/lcdproc: fix build with GCC 15 and musl
PATCH 1/1 package/lcdproc: fix build with GCC 15 and musl
lcdproc includes its bundled shared/getopt.h, which only prototypes getopt() for the GNU C library and otherwise declares it without a parameter list. Since C23, which GCC 15 uses by default, "()" means "no parameters", so the build fails with musl, which declares getopt() in <unistd.h>:
../../shared/getopt.h:136:12: error: conflicting types for 'getopt'; have 'int(void)'
136 | extern int getopt ();
| ^~~~~~lcdexec.c:226:21: error: too many arguments to function 'getopt'; expected 0, have 3
glibc and uClibc-ng define __GNU_LIBRARY__ and get the full prototype, so only musl is affected.
Add a patch, submitted upstream, dropping the include of the bundled header so that the system declaration from <unistd.h> is used.
This issue has been present since commit 75891397abe6 ("package/gcc:
add support for GCC 15.x"), which made GCC 15 available for internal toolchains. It therefore affects 2025.08 and later, i.e. all maintenance branches except 2025.02.x.
Fixes:
https://autobuild.buildroot.org/results/756efe176812427091958621d0bf7db381d443b0
--- ...04-Use-the-system-getopt-declaration.patch | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 package/lcdproc/0004-Use-the-system-getopt-declaration.patch
package/lcdproc/0004-Use-the-system-getopt-declaration.patch new file +85 -0
@@ -0,0 +1,85 @@ +From 8eb8518f93121895b3460d1879d711c743af8c67 Mon Sep 17 00:00:00 2001 +From: Yegor Yefremov <[email protected]> +Date: Fri, 6 Nov 2026 09:49:44 +0100 +Subject: [PATCH] Use the system getopt() declaration + +LCDd and the lcdproc, lcdexec and lcdvc clients include the bundled +shared/getopt.h, which only prototypes getopt() for the GNU C library +and otherwise declares it without a parameter list: + + extern int getopt (); + +Since C23, which GCC 15 uses by default, "()" means "no parameters", +so the build fails with a C library like musl that declares getopt() +in <unistd.h>: + + ../../shared/getopt.h:136:12: error: conflicting types for 'getopt'; have 'int(void)' + 136 | extern int getopt (); + | ^~~~~~ + lcdexec.c:226:21: error: too many arguments to function 'getopt'; expected 0, have 3 + +These programs only use getopt(), optarg and optind, which POSIX +declares in <unistd.h>, already included by all of them. So drop the +include of the bundled header and use the system declaration. + +Upstream: https://github.com/lcdproc/lcdproc/pull/236 +Assisted-by: Claude:claude-opus-5-5 +Signed-off-by: Yegor Yefremov <[email protected]> +--- + clients/lcdexec/lcdexec.c | 2 -- + clients/lcdproc/main.c | 1 - + clients/lcdvc/lcdvc.c | 2 -- + server/main.c | 2 -- + 4 files changed, 7 deletions(-) + +diff --git a/clients/lcdexec/lcdexec.c b/clients/lcdexec/lcdexec.c +index c461b6e..2f2dead 100644 +--- a/clients/lcdexec/lcdexec.c ++++ b/clients/lcdexec/lcdexec.c +@@ -22,8 +22,6 @@ + #include <sys/wait.h> + #include <stdlib.h> + +-#include "getopt.h" +- + #include "shared/str.h" + #include "shared/report.h" + #include "shared/configfile.h" +diff --git a/clients/lcdproc/main.c b/clients/lcdproc/main.c +index b8c570b..fc7a991 100644 +--- a/clients/lcdproc/main.c ++++ b/clients/lcdproc/main.c +@@ -37,7 +37,6 @@ + #include "shared/sockets.h" + #include "shared/report.h" + #include "shared/configfile.h" +-#include "getopt.h" /* This is our local getopt.h! */ + + /* Import screens */ + #include "batt.h" +diff --git a/clients/lcdvc/lcdvc.c b/clients/lcdvc/lcdvc.c +index 2ae2875..2cd1fbc 100644 +--- a/clients/lcdvc/lcdvc.c ++++ b/clients/lcdvc/lcdvc.c +@@ -22,8 +22,6 @@ + #include <errno.h> + #include <stdlib.h> + +-#include "getopt.h" +- + #include "shared/report.h" + #include "shared/configfile.h" + #include "shared/sockets.h" +diff --git a/server/main.c b/server/main.c +index c80aef4..8f58658 100644 +--- a/server/main.c ++++ b/server/main.c +@@ -44,8 +44,6 @@ + #include <sys/types.h> + #include <limits.h> + +-#include "getopt.h" +- + #ifdef HAVE_SYS_TIME_H + # include <sys/time.h> + #endif
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot