From 3c6f2bf301d529c0836ef591af2663a429850964 Mon Sep 17 00:00:00 2001 From: vasilito Date: Sun, 28 Jun 2026 16:12:48 +0300 Subject: [PATCH] relibc: mirror fresh libc to prefix and redoxer toolchain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After cooking relibc, copy the freshly built libc.a and libc.so to both the prefix toolchain and the redoxer toolchain (the latter is what 'make live' actually consumes for cross-recipe builds). Without this, recipes that link against the dynamic libc.so see a stale copy (no eventfd, no __fseterr, ...) and fail with 'undefined reference' at link time. 'make prefix' does this sync via its sysroot rule, but 'make r.relibc' alone does not — covering both paths prevents the first recipe that needs a new symbol from breaking the build. --- recipes/core/relibc/recipe.toml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/recipes/core/relibc/recipe.toml b/recipes/core/relibc/recipe.toml index 1a28c222e2..77e1002766 100644 --- a/recipes/core/relibc/recipe.toml +++ b/recipes/core/relibc/recipe.toml @@ -37,4 +37,26 @@ export CARGO=${CARGO:-env -u CARGO cargo} sed -i '/^int vfprintf(/s/\\.\\.\\./va_list ap/' "${COOKBOOK_STAGE}/usr/include/stdio.h" sed -i '/^int vsnprintf(/s/\\.\\.\\./va_list ap/' "${COOKBOOK_STAGE}/usr/include/stdio.h" sed -i '/^int vsprintf(/s/\\.\\.\\./va_list ap/' "${COOKBOOK_STAGE}/usr/include/stdio.h" + +# Mirror the freshly built libc into the prefix toolchain. `make prefix` +# does this via mk/prefix.mk, but `make r.relibc` alone does not, and +# recipes that link against the dynamic libc.so would otherwise see a +# stale libc.so (no eventfd, no __fseterr, ...) and fail with +# "undefined reference" at link time. The redoxer toolchain is what +# `make live` actually consumes for cross-recipe builds, so it must +# stay in sync too. +PREFIX_LIB_DIR="${COOKBOOK_HOST_SYSROOT%/}/${TARGET}/lib" +if [ -d "${PREFIX_LIB_DIR}" ]; then + cp -f "${COOKBOOK_STAGE}/usr/lib/libc.a" "${PREFIX_LIB_DIR}/" 2>/dev/null || true + if [ -f "${COOKBOOK_STAGE}/usr/lib/libc.so" ]; then + cp -f "${COOKBOOK_STAGE}/usr/lib/libc.so" "${PREFIX_LIB_DIR}/" 2>/dev/null || true + fi +fi +REDOXER_TC_LIB="${HOME}/.redoxer/${TARGET}/toolchain/${TARGET}/lib" +if [ -d "${REDOXER_TC_LIB}" ]; then + cp -f "${COOKBOOK_STAGE}/usr/lib/libc.a" "${REDOXER_TC_LIB}/" 2>/dev/null || true + if [ -f "${COOKBOOK_STAGE}/usr/lib/libc.so" ]; then + cp -f "${COOKBOOK_STAGE}/usr/lib/libc.so" "${REDOXER_TC_LIB}/" 2>/dev/null || true + fi +fi """