From 2382aa496f53e116c8ff1de82e8271d744502531 Mon Sep 17 00:00:00 2001 From: vasilito Date: Tue, 30 Jun 2026 03:57:51 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20prefix.mk=20=E2=80=94=20patch=20sysroot+?= =?UTF-8?q?redoxer=20cstdlib=20for=20strtold?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously only gcc-install was patched. Recipes use sysroot copy which is a copy of relibc-install (NOT gcc-install), so the cstdlib strtold fix never propagated to the actual compilation environment. Patch both sysroot and redoxer toolchain copies. --- mk/prefix.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mk/prefix.mk b/mk/prefix.mk index 37c211eb05..3efcb091c0 100644 --- a/mk/prefix.mk +++ b/mk/prefix.mk @@ -103,6 +103,22 @@ ifeq ($(PODMAN_BUILD),1) else rm -rf "$@" cp -r "$(PREFIX)/relibc-install/" "$@" +# Patch relibc sysroot and redoxer toolchain GCC for strtold. +# relibc declares strtold in stdlib.h (cbindgen trailer) but GCC's +# cstdlib does 'using ::strtold' before the trailer is processed. +# Add explicit #include after #include_next +# so ::strtold is visible when the C++ wrapper runs its using. + for _cstdlib in "$(COOKBOOK_ROOT)/prefix/${TARGET}/sysroot/${GNU_TARGET}/include/c++"/*/cstdlib; do \ + [ -f "$$_cstdlib" ] || continue; \ + sed -i '/^#include_next $$/a\\n// Red Bear: relibc declares strtold via cbindgen trailer.\n// The explicit include ensures ::strtold is visible when the\n// C++ wrapper processes its using-directives below.\n#include ' "$$_cstdlib"; \ + done + @REDOXER_TC=$(HOME)/.redoxer/$(TARGET)/toolchain/$(GNU_TARGET); \ + if [ -d "$$REDOXER_TC/include/c++" ]; then \ + for _cstdlib in "$$REDOXER_TC/include/c++"/*/cstdlib; do \ + [ -f "$$_cstdlib" ] || continue; \ + sed -i '/^#include_next $$/a\\n// Red Bear: relibc declares strtold via cbindgen trailer.\n// The explicit include ensures ::strtold is visible when the\n// C++ wrapper processes its using-directives below.\n#include ' "$$_cstdlib"; \ + done; \ + fi # Propagate fresh relibc artifacts (libc.a, crt*.o, headers) from the # rebuilt sysroot back into gcc-install. The GCC driver's built-in # library search path always looks inside gcc-install/ first; if that