Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/vorbis-tools: fix build with GCC 15
@ 2026-08-17 15:54 Shubham Chakraborty
  2026-09-01 21:30 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Shubham Chakraborty @ 2026-08-17 15:54 UTC (permalink / raw)
  To: buildroot; +Cc: Shubham Chakraborty

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 <chakrabortyshubham66@gmail.com>
---
 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
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-01 21:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-17 15:54 [Buildroot] [PATCH] package/vorbis-tools: fix build with GCC 15 Shubham Chakraborty
2026-09-01 21:30 ` Thomas Petazzoni via buildroot

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