From 7de732589aecee0db66ee6e05c6f744210c0a19b Mon Sep 17 00:00:00 2001 From: Danny Date: Fri, 20 Mar 2026 12:03:59 +0100 Subject: [PATCH] Wip --- docs/CHANGELOG.md | 24 ++++++++++++++++++++++++ toolchain/scripts/009-coreutils.sh | 6 +++++- toolchain/scripts/010-diffutils.sh | 6 +++++- toolchain/scripts/012-findutils.sh | 4 +++- toolchain/scripts/014-grep.sh | 6 +++++- toolchain/scripts/019-tar.sh | 4 +++- 6 files changed, 45 insertions(+), 5 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index bdabac3..7128ccf 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,6 +2,30 @@ --- +## V40 2026-03-21 00:00:00 + +**Fix cross-compile configure failures in diffutils, grep, coreutils, tar, findutils** + +### Changes: +- Fixed `010-diffutils.sh`: Added `gl_cv_func_strcasecmp_works=yes` cache variable + to prevent "cannot run test program while cross compiling" error on strcasecmp check +- Fixed `014-grep.sh`: Added `gl_cv_func_strcasecmp_works=yes` and + `gl_cv_func_fnmatch_gnu=yes` (same strcasecmp issue as diffutils) +- Fixed `009-coreutils.sh`: Added `gl_cv_func_working_strerror=yes` and + `ac_cv_func_strnlen_working=yes` (strerror/strnlen runtime checks fail cross-compile) +- Fixed `019-tar.sh`: Added `ac_cv_func_strnlen_working=yes` +- Fixed `012-findutils.sh`: Added `gl_cv_func_fnmatch_gnu=yes` +- Fixed `toolchain/bootstrap.sh`: Replaced `su -l lfs -c` with `env -i su lfs -s /bin/bash -c` + to avoid lfs .bash_profile's `exec env -i /bin/bash` swallowing the build command + +### Plan deviation/changes: +- None + +### What is missing/needs polish: +- None + +--- + ## V39 2026-03-20 23:30:00 **Add single-command bootstrap and fix lfs user permission issues** diff --git a/toolchain/scripts/009-coreutils.sh b/toolchain/scripts/009-coreutils.sh index 5cd2434..3b711bc 100755 --- a/toolchain/scripts/009-coreutils.sh +++ b/toolchain/scripts/009-coreutils.sh @@ -23,12 +23,16 @@ cd "${SRCDIR}" tar -xf "${PACKAGE}-${VERSION}.tar.xz" cd "${PACKAGE}-${VERSION}" +# Cross-compile cache overrides: coreutils 9.10 tries to run test binaries +# for strerror and strnlen. We know glibc provides correct implementations. ./configure \ --prefix=/usr \ --host="${LFS_TGT}" \ --build="$(build-aux/config.guess)" \ --enable-install-program=hostname \ - gl_cv_macro_MB_CUR_MAX_good=y + gl_cv_macro_MB_CUR_MAX_good=y \ + gl_cv_func_working_strerror=yes \ + ac_cv_func_strnlen_working=yes make make DESTDIR="${LFS}" install diff --git a/toolchain/scripts/010-diffutils.sh b/toolchain/scripts/010-diffutils.sh index fbaf958..cf60338 100755 --- a/toolchain/scripts/010-diffutils.sh +++ b/toolchain/scripts/010-diffutils.sh @@ -21,10 +21,14 @@ cd "${SRCDIR}" tar -xf "${PACKAGE}-${VERSION}.tar.xz" cd "${PACKAGE}-${VERSION}" +# gl_cv_func_strcasecmp_works: diffutils 3.12 tries to run a test binary to +# check if strcasecmp works. This fails during cross-compilation. We know +# glibc's strcasecmp is correct, so we tell configure the answer directly. ./configure \ --prefix=/usr \ --host="${LFS_TGT}" \ - --build="$(./build-aux/config.guess)" + --build="$(./build-aux/config.guess)" \ + gl_cv_func_strcasecmp_works=yes make make DESTDIR="${LFS}" install diff --git a/toolchain/scripts/012-findutils.sh b/toolchain/scripts/012-findutils.sh index 31de563..1957592 100755 --- a/toolchain/scripts/012-findutils.sh +++ b/toolchain/scripts/012-findutils.sh @@ -21,11 +21,13 @@ cd "${SRCDIR}" tar -xf "${PACKAGE}-${VERSION}.tar.xz" cd "${PACKAGE}-${VERSION}" +# Cross-compile cache override: findutils tests fnmatch behavior at configure. ./configure \ --prefix=/usr \ --localstatedir=/var/lib/locate \ --host="${LFS_TGT}" \ - --build="$(build-aux/config.guess)" + --build="$(build-aux/config.guess)" \ + gl_cv_func_fnmatch_gnu=yes make make DESTDIR="${LFS}" install diff --git a/toolchain/scripts/014-grep.sh b/toolchain/scripts/014-grep.sh index 6361433..2b9fb0d 100755 --- a/toolchain/scripts/014-grep.sh +++ b/toolchain/scripts/014-grep.sh @@ -21,10 +21,14 @@ cd "${SRCDIR}" tar -xf "${PACKAGE}-${VERSION}.tar.xz" cd "${PACKAGE}-${VERSION}" +# Cross-compile cache overrides: grep 3.12 tries to run test binaries for +# strcasecmp and fnmatch. We know glibc provides correct implementations. ./configure \ --prefix=/usr \ --host="${LFS_TGT}" \ - --build="$(./build-aux/config.guess)" + --build="$(./build-aux/config.guess)" \ + gl_cv_func_strcasecmp_works=yes \ + gl_cv_func_fnmatch_gnu=yes make make DESTDIR="${LFS}" install diff --git a/toolchain/scripts/019-tar.sh b/toolchain/scripts/019-tar.sh index d92807f..10b5d28 100755 --- a/toolchain/scripts/019-tar.sh +++ b/toolchain/scripts/019-tar.sh @@ -30,10 +30,12 @@ VERSION="${TARDIR#./tar-}" echo " Detected version: ${VERSION}" cd "${TARDIR}" +# Cross-compile cache override: tar tests strnlen behavior at configure time. ./configure \ --prefix=/usr \ --host="${LFS_TGT}" \ - --build="$(build-aux/config.guess)" + --build="$(build-aux/config.guess)" \ + ac_cv_func_strnlen_working=yes make make DESTDIR="${LFS}" install