mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-10-01 22:41:43 -09:00
enscript currently fails to build with musl with gcc >= 15. In order to fix this, we need to bring a number of patches from upstream, and add 2 others that were submitted upstream. From upstream, we bring 0002-Add-CFLAG-std-c89-so-it-compiles-with-the-old-standa.patch, which switches to -std=c89 to get the compiler back to "old" behavior. However, as this commit patches configure.ac, we need to autoreconf, but autoreconf is broken, so we also take 0003-Automake-1.12-and-up-no-longer-supports-pre-ANSI.patch from upstream, which drops a problematic autoconf macro. However, once you drop this problematic autoconf macro, the PROTOTYPES define is never set by anything, causing the __P macro to no longer be defined properly. This is fixed by 0004-Fix-prototype-detection-when-__STDC__-is-defined-but.patch that we have submitted upstream. Once you're there, you realize that switching to -std=c89 has the side effect that musl's <limits.h> no longer defines PATH_MAX, because it needs one of: #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) and a side effect of -std=c89 is that none of these is defined anymore. So we introduce 0005-Use-std-gnu89-instead-of-std-c89.patch, which switches to -std=gnu89. This patch has also been submitted upstream. With all of these efforts, we get a successful build on musl with gcc >= 15. This commit needs to be backported to Buildroot versions that support gcc 15.x, so that means the currently maintained 2026.x branches, but not 2025.02 as only up to gcc 14.x was supported then. Fixes: https://autobuild.buildroot.org/results/d39d14bbbb3a51d67fe962b877c7f66ff1204ecf/ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Julien Olivain <ju.o@free.fr>
36 lines
1.1 KiB
Diff
36 lines
1.1 KiB
Diff
From be920933dbe1fb73c27fecb280200f6f06abfdc2 Mon Sep 17 00:00:00 2001
|
|
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
|
Date: Sat, 22 Aug 2026 15:19:17 +0200
|
|
Subject: [PATCH] Use -std=gnu89 instead of -std=c89
|
|
|
|
-std=c89 suppresses feature test macros, which causes <limits.h> to
|
|
not define PATH_MAX on certain C libraries (e.g. musl). Using
|
|
-std=gnu89 enables _GNU_SOURCE and other extensions, ensuring
|
|
PATH_MAX and other POSIX constants are available.
|
|
|
|
This most notably fixes the build with the musl C library.
|
|
|
|
Upstream: https://savannah.gnu.org/bugs/index.php?68634
|
|
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
|
---
|
|
configure.ac | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 4431cb1..46ea59d 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -11,7 +11,8 @@ AC_PROG_INSTALL
|
|
AC_PROG_CC
|
|
|
|
# Force C89 standard and fix modern GCC global variable handling
|
|
-CFLAGS="$CFLAGS -std=c89"
|
|
+# Use GNU89 to access PATH_MAX in <limits.h>
|
|
+CFLAGS="$CFLAGS -std=gnu89"
|
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
|
|
|
--
|
|
2.55.0
|
|
|