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
Backport host gcc 15/16 build fixes (m4, gmp, gcc) to 2025.02-op-build#40runlevel5 wants to merge 3 commits into
runlevel5 wants to merge 3 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 the2025.02LTS branch this fork is based on.This backports the three needed fixes so the toolchain builds under gcc 16:
package/gmpacinclude.m4(GMP_PROG_CC_WORKS) for C23 — otherwise configure reports "could not find a working compiler". Cherry-pick of upstream31569bcc1b.package/m4-std=gnu17for host-m4 (bundled gnulib breaks under gnu23). Backport of7a07a9d155, applied unconditionally since 2025.02 lacksBR2_HOST_GCC_AT_LEAST_15.package/gccchar8_t/ include-order fixes for building gcc with host gcc 16. The two patches from upstream10ccbe079c(carried in13.4.0/), added to13.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=gnu17form to match the stable-backport intent.