]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
ghostscript: ensure the native compile uses C17
authorRoss Burton <ross.burton@arm.com>
Thu, 2 Apr 2026 13:41:43 +0000 (14:41 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 9 Apr 2026 09:30:27 +0000 (10:30 +0100)
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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-extended/ghostscript/ghostscript_10.06.0.bb

index 951cbc19565145920f358be2c9519bb82331c148..e0add4bae96f81291004238ac5750dfd7eae8a9d 100644 (file)
@@ -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