* [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
* Re: [Buildroot] [PATCH] package/vorbis-tools: fix build with GCC 15
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
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-09-01 21:30 UTC (permalink / raw)
To: Shubham Chakraborty; +Cc: buildroot
On Mon, Aug 17, 2026 at 09:24:11PM +0530, Shubham Chakraborty wrote:
> 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>
The problem only seems to occur with musl, not glibc. Why? This means
it's not just a GCC version issue.
Also, can we actually fix the issues? It seems like it's just 2
prototypes that are wrong.
But even for musl, why is it trying to use its own version of getenv()
and getopt()? musl is providing those features.
So I don't doubt that passing -std=gnu17 papers over the problem, but
the analysis is a bit weak, and the proposed solution not quite up to
the quality standard that we expect.
Could you research this a bit more?
Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [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