test
This commit is contained in:
@@ -2,6 +2,27 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## V44 2026-03-21 01:30:00
|
||||||
|
|
||||||
|
**Fix zlib chicken-and-egg: bootstrap host libz.so.1 into chroot before building**
|
||||||
|
|
||||||
|
### Changes:
|
||||||
|
- Updated `023a-chroot-build-all.sh`: Before entering the chroot, copies the host
|
||||||
|
system's `libz.so.1` into `$LFS/usr/lib/`. This breaks the circular dependency:
|
||||||
|
ld needs libz.so.1 → can't link without it → can't build zlib without linking.
|
||||||
|
The temporary copy lets ld work, so zlib's configure tests pass, and the real
|
||||||
|
zlib build (024a-zlib.sh) replaces the temporary copy with a proper one.
|
||||||
|
|
||||||
|
### Plan deviation/changes:
|
||||||
|
- None
|
||||||
|
|
||||||
|
### What is missing/needs polish:
|
||||||
|
- The host-copied libz.so.1 is a temporary hack. It gets replaced by the real
|
||||||
|
zlib build immediately. If the host doesn't have zlib, the user needs to
|
||||||
|
install it first (pacman -S zlib on Arch).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## V43 2026-03-21 01:15:00
|
## V43 2026-03-21 01:15:00
|
||||||
|
|
||||||
**Add zlib build to chroot phase — ld needs libz.so.1 at runtime**
|
**Add zlib build to chroot phase — ld needs libz.so.1 at runtime**
|
||||||
|
|||||||
@@ -38,6 +38,30 @@ echo " DarkForge Linux — Chroot Build Phase (Chapter 7)"
|
|||||||
echo "============================================================"
|
echo "============================================================"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
# --- Bootstrap libz.so.1 from host -------------------------------------------
|
||||||
|
# Chicken-and-egg problem: the linker (ld) from binutils pass 2 was built with
|
||||||
|
# zlib support and dynamically links against libz.so.1. But zlib isn't installed
|
||||||
|
# in the chroot yet. Without libz.so.1, ld can't run, so nothing can link, so
|
||||||
|
# we can't even build zlib properly. Fix: copy the host's libz into the chroot
|
||||||
|
# temporarily. The real zlib build (024a-zlib.sh) will replace it.
|
||||||
|
warn "Bootstrapping libz.so.1 from host into chroot..."
|
||||||
|
HOST_LIBZ=$(find /usr/lib /usr/lib64 /lib /lib64 -name 'libz.so.1*' -type f 2>/dev/null | head -1)
|
||||||
|
if [ -z "${HOST_LIBZ}" ]; then
|
||||||
|
# Try ldconfig cache
|
||||||
|
HOST_LIBZ=$(ldconfig -p 2>/dev/null | grep 'libz.so.1 ' | awk '{print $NF}' | head -1)
|
||||||
|
fi
|
||||||
|
if [ -n "${HOST_LIBZ}" ]; then
|
||||||
|
cp -Lv "${HOST_LIBZ}" "${LFS}/usr/lib/libz.so.1"
|
||||||
|
# Also create the .so symlink for the linker
|
||||||
|
ln -sfv libz.so.1 "${LFS}/usr/lib/libz.so"
|
||||||
|
ok "Copied host libz.so.1 → ${LFS}/usr/lib/libz.so.1"
|
||||||
|
ok "ld should now be able to link inside the chroot"
|
||||||
|
else
|
||||||
|
warn "Could not find host libz.so.1 — zlib build in chroot may fail"
|
||||||
|
warn "Install zlib on the host: sudo pacman -S zlib"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
# Build a script that runs inside the chroot
|
# Build a script that runs inside the chroot
|
||||||
# We write it to a temp file inside $LFS so the chroot can see it
|
# We write it to a temp file inside $LFS so the chroot can see it
|
||||||
cat > "${LFS}/tmp/chroot-build-runner.sh" << 'CHROOT_EOF'
|
cat > "${LFS}/tmp/chroot-build-runner.sh" << 'CHROOT_EOF'
|
||||||
|
|||||||
Reference in New Issue
Block a user