diff mbox series

[2/2] ghostscript: ensure the native compile uses C17

Message ID 20260402134143.1045721-2-ross.burton@arm.com
State New
Headers show
Series [1/2] ghostscript: do out-of-tree builds | expand

Commit Message

Ross Burton April 2, 2026, 1:41 p.m. UTC
GCC 15.2 defaults to C23:

  $ aarch64-poky-linux-gcc --version
  aarch64-poky-linux-gcc (GCC) 15.2.0
  $ aarch64-poky-linux-gcc -dM -E - </dev/null | grep STDC_VERSION
  #define __STDC_VERSION__ 202311L

As of ghostscript 10.06.0 the build is good with C23[1] and our cross
compiler is 15.2, so we can stop adding -std=gnu17 to the target CFLAGS.

However, our buildtools are currently using GCC 14.2 which has the
interesting behaviour that it has a -std=gnu23 option but does not then
actually claim to support C23:

  $ gcc --version
  gcc (GCC) 14.2.0
  $ gcc -std=gnu23 -dM -E - </dev/null | grep STDC_VERSION
  #define __STDC_VERSION__ 202000L

This then interacts badly with autoconf 2.73 which tells the compiler to
use C23, breaking stdpre.h which handles a number of different
compilers and C standards.

A bug has been filed with ghostscript[2] to try and handle this this
case in the source, but a workaround is to tell the native compiles to
explicitly use C17.

[1] ghostscript ae9409464 ("Bug 708160: Fix compatibility with C23 compilers")
[2] https://bugs.ghostscript.com/show_bug.cgi?id=709290

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-extended/ghostscript/ghostscript_10.06.0.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/recipes-extended/ghostscript/ghostscript_10.06.0.bb b/meta/recipes-extended/ghostscript/ghostscript_10.06.0.bb
index 951cbc19565..e0add4bae96 100644
--- a/meta/recipes-extended/ghostscript/ghostscript_10.06.0.bb
+++ b/meta/recipes-extended/ghostscript/ghostscript_10.06.0.bb
@@ -40,6 +40,7 @@  EXTRA_OECONF = "--with-jbig2dec \
                 --with-fontpath=${datadir}/fonts \
                 CUPSCONFIG="${STAGING_BINDIR_CROSS}/cups-config" \
                 PKGCONFIG=pkg-config \
+                CFLAGSAUX=-std=gnu17 \
                 "
 
 EXTRA_OECONF:append:mipsarcho32 = " --with-large_color_index=0"
@@ -47,7 +48,7 @@  EXTRA_OECONF:append:mipsarcho32 = " --with-large_color_index=0"
 EXTRA_OECONF:append:armv7a = "${@bb.utils.contains('TUNE_FEATURES','neon','',' --disable-neon',d)}"
 EXTRA_OECONF:append:armv7ve = "${@bb.utils.contains('TUNE_FEATURES','neon','',' --disable-neon',d)}"
 
-TARGET_CFLAGS += "-std=gnu17 -Wno-error=declaration-after-statement -fPIC"
+TARGET_CFLAGS += "-Wno-error=declaration-after-statement -fPIC"
 
 inherit autotools pkgconfig