[Buildroot] [PATCH] package/vorbis-tools: fix build with GCC 15

Shubham Chakraborty <[email protected]>
Newsgroups net.busybox.buildroot
Message-ID <[email protected]>
vorbis-tools fails to build with GCC 15 because its bundled legacy
getopt implementation uses unprototyped K&R C function declarations
(such as `extern char *getenv();`). GCC 15 defaults to -std=gnu23
(C23), where unprototyped functions are strictly treated as (void),
causing compilation to fail with:

getopt.c:399:21: error: too many arguments to function 'getenv'; expected 0, have 1

Fix this by preserving Buildroot's TARGET_CFLAGS and appending -std=gnu17
for toolchains that support it (GCC >= 8).

Tested with `./utils/test-pkg -p vorbis-tools -a`:
32 builds, 0 skipped, 0 build failed, 0 legal-info failed, 0 show-info failed

Fixes:
 - https://autobuild.buildroot.org/results/dda/dda9e20f43368898b913bf2b00a8491ba089643f/

Signed-off-by: Shubham Chakraborty <[email protected]>
---
 package/vorbis-tools/vorbis-tools.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/package/vorbis-tools/vorbis-tools.mk b/package/vorbis-tools/vorbis-tools.mk
index d64fe0b1ee..869224c4df 100644
--- a/package/vorbis-tools/vorbis-tools.mk
+++ b/package/vorbis-tools/vorbis-tools.mk
@@ -15,6 +15,13 @@ VORBIS_TOOLS_CONF_OPTS = --program-transform-name=''
 # ogg123 calls math functions but forgets to link with libm
 VORBIS_TOOLS_CONF_ENV = LIBS=-lm
 
+# GCC 15 and newer default to -std=gnu23, which breaks the legacy
+# K&R-style function declarations used by vorbis-tools.
+# Use GNU C17 for toolchains that support it.
+ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_8),y)
+VORBIS_TOOLS_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -std=gnu17"
+endif
+
 ifeq ($(BR2_PACKAGE_FLAC),y)
 VORBIS_TOOLS_DEPENDENCIES += flac
 endif
-- 
2.55.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.