From 2ab24f9aea12c1f5557541b39fd14a7283b01160 Mon Sep 17 00:00:00 2001 From: Danny Date: Fri, 20 Mar 2026 13:44:07 +0100 Subject: [PATCH] fixed missing symlinks --- docs/CHANGELOG.md | 22 ++++++++++++++++++++++ toolchain/scripts/024-chroot-essentials.sh | 13 +++++++++++++ 2 files changed, 35 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index bc8d7d0..20922c5 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -2,6 +2,28 @@ --- +## V42 2026-03-21 01:00:00 + +**Fix chroot gcc linker failure — create cross-prefix symlinks for ld** + +### Changes: +- Fixed `024-chroot-essentials.sh`: Added creation of `/usr/x86_64-darkforge-linux-gnu/bin/` + with symlinks to `/usr/bin/` for ld, as, ar, nm, objcopy, objdump, ranlib, readelf, strip. + GCC pass 2 was configured with `--target=x86_64-darkforge-linux-gnu`, so it looks for + the linker at `/usr/x86_64-darkforge-linux-gnu/bin/ld`. But binutils pass 2 installed + `ld` to `/usr/bin/ld`. The missing symlink caused `ld returned 127` (not found) → + "C compiler cannot create executables" in all Chapter 7 builds. +- Added gcc diagnostic section to `024-chroot-essentials.sh` to catch this class of + issue early with clear error messages. + +### Plan deviation/changes: +- None + +### What is missing/needs polish: +- None + +--- + ## V41 2026-03-21 00:30:00 **Fix chroot PATH and add combined chroot build runner** diff --git a/toolchain/scripts/024-chroot-essentials.sh b/toolchain/scripts/024-chroot-essentials.sh index b30c6bc..306588a 100755 --- a/toolchain/scripts/024-chroot-essentials.sh +++ b/toolchain/scripts/024-chroot-essentials.sh @@ -23,6 +23,19 @@ echo "=== DarkForge: Creating essential files and symlinks ===" [ -L /lib ] || { echo "ERROR: /lib should be a symlink to usr/lib"; exit 1; } [ -L /sbin ] || { echo "ERROR: /sbin should be a symlink to usr/sbin"; exit 1; } +# --- Create toolchain cross-prefix symlinks ----------------------------------- +# GCC pass 2 was configured with --target=x86_64-darkforge-linux-gnu, so it +# looks for the linker (ld) and assembler (as) at: +# /usr/x86_64-darkforge-linux-gnu/bin/ld +# But binutils pass 2 installed them to /usr/bin/ld. We need symlinks. +echo ">>> Creating cross-prefix symlinks for gcc to find ld/as..." +mkdir -pv /usr/x86_64-darkforge-linux-gnu/bin +for tool in ld ld.bfd ar as nm objcopy objdump ranlib readelf strip; do + if [ -f "/usr/bin/${tool}" ]; then + ln -sfv "../../bin/${tool}" "/usr/x86_64-darkforge-linux-gnu/bin/${tool}" + fi +done + # --- Create /etc/passwd ------------------------------------------------------- cat > /etc/passwd << "EOF" root:x:0:0:root:/root:/bin/bash