Skip to content

Backport host gcc 15/16 build fixes (m4, gmp, gcc) to 2025.02-op-build#40

Open
runlevel5 wants to merge 3 commits into
open-power:2025.02-op-buildfrom
runlevel5:2025.02-op-build-host-gcc16
Open

Backport host gcc 15/16 build fixes (m4, gmp, gcc) to 2025.02-op-build#40
runlevel5 wants to merge 3 commits into
open-power:2025.02-op-buildfrom
runlevel5:2025.02-op-build-host-gcc16

Conversation

@runlevel5
Copy link
Copy Markdown

Building op-build natively on a modern host (e.g. Fedora 44 / gcc 16, or Ubuntu 26.04 / gcc 15.2) fails in the host-tool / cross-toolchain layer, because gcc ≥ 15 defaults to -std=gnu23 (C23) and gcc 16 defaults to a newer C++ standard. These fixes already exist in upstream buildroot but are not in the 2025.02 LTS branch this fork is based on.

This backports the three needed fixes so the toolchain builds under gcc 16:

Commit Package Fix
package/gmp gmp 6.3.0 Complete a function prototype in acinclude.m4 (GMP_PROG_CC_WORKS) for C23 — otherwise configure reports "could not find a working compiler". Cherry-pick of upstream 31569bcc1b.
package/m4 m4 1.4.19 Force -std=gnu17 for host-m4 (bundled gnulib breaks under gnu23). Backport of 7a07a9d155, applied unconditionally since 2025.02 lacks BR2_HOST_GCC_AT_LEAST_15.
package/gcc gcc 13.3.0 libcody char8_t / include-order fixes for building gcc with host gcc 16. The two patches from upstream 10ccbe079c (carried in 13.4.0/), added to 13.3.0/.

Testing

With these three commits on 2025.02-op-build, a native blackbird build on a Fedora 44 host (gcc 16, binutils 2.46) gets the full host/cross toolchain to build (host-m4 → gmp/mpfr/mpc → host-gcc-initial 13.3.0), where it previously failed at host-m4. Build then proceeds into target userspace.

Alternative considered: bumping m4 to 1.4.20 (upstream d9aabc1af3) instead of the workaround — kept the minimal -std=gnu17 form to match the stable-backport intent.

jolivain and others added 3 commits June 3, 2026 15:33
When using host gcc 15, host-gmp fails at configure time with
error message:

    configure: error: could not find a working compiler, see config.log for details

The error is due to the macro GMP_PROG_CC_WORKS in the file
acinclude.m4 containing C-code declaring functions without declaring
its parameters. This construct is now an error in C23, which is the
new default in gcc 15. See:
https://gcc.gnu.org/gcc-15/porting_to.html#c23

This commit fixes the issue by adding a package patch from
upstream changesets, not yet published in a release.

Even if gcc 15 is not yet included in Buildroot, this commit also
sets _AUTORECONF = YES for the target package in order to have this
package already fixed.

Fixes:
https://autobuild.buildroot.org/results/623634fa7bbeceeb6d90b15ce0abb1b9b4b24045/

Tested-by: Brigham Campbell <me@brighamcampbell.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
(cherry picked from commit 31569bc)
When compiling host-m4 1.4.19 with host gcc >= 15 (default on Fedora 42+
/ Ubuntu 25.10+), the build fails because gcc 15 changed its default C
standard from gnu17 to gnu23, which the gnulib copy bundled in m4 1.4.19
does not detect properly:

    gl_oset.h:275:40: error: expected identifier or '(' before 'int'

Force the previous default -std=gnu17 for the host-m4 build.

This is a backport of upstream commit 7a07a9d ("package/m4: fix build
failure with host-gcc 15"), applied unconditionally because the 2025.02
branch does not have the BR2_HOST_GCC_AT_LEAST_15 symbol used upstream;
-std=gnu17 is a no-op on gcc < 15 (the option exists since gcc 8).

Signed-off-by: Trung Le <8@tle.id.au>
Building gcc 13.3.0 with a host gcc 16 fails because gcc 16 defaults to a
newer C++ standard in which u8"" literals are char8_t, which libcody and
the gcc build system do not handle:

    libcody/buffer.cc:348:39: error: no matching function for call to
        'S2C(const char8_t [2])'

Backport the two upstream patches that fix this (from buildroot commit
10ccbe079c "package/gcc: fix gcc-13 build with host gcc 16", which carries
them in package/gcc/13.4.0/): a libcody fix to build under C++11..C++26,
and an include-order fix in gcc/system.h. Numbered 0006/0007 to sit after
the existing 13.3.0 patch series.

Signed-off-by: Trung Le <8@tle.id.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants