From deca6a6820d2ee180a22999e93ba5b084aa96df5 Mon Sep 17 00:00:00 2001 From: vasilito Date: Mon, 3 Aug 2026 18:31:03 +0300 Subject: [PATCH] gcc13: scope -std=gnu++17 to the target branch (char8_t fixed; probe still open) libcody is compiled by the CROSS compiler, not the host one -- the build log shows x86_64-unknown-redox-g++ ... -c -o buffer.o .../libcody/buffer.cc because --host is the Redox target. So plain CXXFLAGS is the right knob, not CXXFLAGS_FOR_BUILD as the previous commit assumed. Scoped to the gcc-native branch only. Verified: char8_t errors go 100+ -> 0. STILL OPEN. With CXXFLAGS set, the top-level configure now fails its build-side probe: checking whether gcc accepts -g... no configure: error: C++11 is required The two states are exclusive as things stand: - CXXFLAGS carrying -std=gnu++17 -> char8_t fixed, C++11 probe fails - CXXFLAGS without it -> probe passes, char8_t fails so something in the exported CXXFLAGS is unacceptable to the HOST gcc that configure probes (the cookbook adds -fno-hardened -DHAVE_ALLOCA_H=1 -fPIC alongside a target -I). The recipe unsets CFLAGS/CPPFLAGS/LDFLAGS for this branch but leaves CXXFLAGS set, which is the likely culprit -- the next step is to give the build-side compiler its own clean flags rather than inheriting the target's. --- recipes/dev/gcc13/recipe.toml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/recipes/dev/gcc13/recipe.toml b/recipes/dev/gcc13/recipe.toml index 6e5fa9e3b5..1426ea42b6 100644 --- a/recipes/dev/gcc13/recipe.toml +++ b/recipes/dev/gcc13/recipe.toml @@ -42,15 +42,7 @@ export gcc_cv_sys_sdt_h=no # in libcody/{buffer,client,server}.cc. # # This is not a workaround: C++17 is the dialect this release was written -# against, and GCC's own build documentation expects the host compiler to be -# driven at the standard the sources use. Applies to both the cross-toolchain -# and the gcc-native target build below, which share this script. -# Build-side ONLY. libcody is compiled by CXX_FOR_BUILD (the host g++ 16), -# which is where the char8_t failures occur. Putting -std=gnu++17 into plain -# CXXFLAGS also hands it to the Redox cross g++, whose C++ probe then fails -# during the freestanding stage before libstdc++ exists: -# configure: error: C++11 is required -export CXXFLAGS_FOR_BUILD="${CXXFLAGS_FOR_BUILD:+$CXXFLAGS_FOR_BUILD }-std=gnu++17" +# against. Applied in the target branch below, not here -- see the note there. if [ "${COOKBOOK_HOST_SYSROOT}" = "/usr" ]; then # not specifying --enable-shared as it will link shared deps @@ -68,6 +60,17 @@ COOKBOOK_CONFIGURE_FLAGS=( else export CFLAGS_FOR_TARGET="${CPPFLAGS}" CXXFLAGS_FOR_TARGET="${CPPFLAGS}" LDFLAGS_FOR_TARGET="${LDFLAGS}" export CC_FOR_BUILD="$CC_WRAPPER gcc" CXX_FOR_BUILD="$CC_WRAPPER g++" +# GCC 13's sources are C++17. libcody is compiled here by the CROSS compiler -- +# the build log shows +# x86_64-unknown-redox-g++ ... -c -o buffer.o .../libcody/buffer.cc +# because --host is the Redox target -- and that compiler is now GCC 16, which +# defaults to C++20. C++20 changed u8"" literals from const char[] to +# const char8_t[], which libcody uses throughout, so the build collapses with +# error: invalid conversion from 'const char8_t*' to 'const char*' +# Scoped to this branch: the freestanding cross-toolchain branch above must not +# get it, or its C++ probe fails before libstdc++ exists with +# configure: error: C++11 is required +export CXXFLAGS="${CXXFLAGS:+$CXXFLAGS }-std=gnu++17" unset CFLAGS CPPFLAGS LDFLAGS COOKBOOK_CONFIGURE_FLAGS+=( --with-sysroot=/