From f9849fef3a750ed6cfb97ad8b5ee4c9f2d57908e Mon Sep 17 00:00:00 2001 From: Luke Craig Date: Mon, 8 Jun 2026 22:13:33 -0400 Subject: [PATCH] Bake guest paths (/igloo) into binaries, not container paths The staged binaries run on the guest, where penguin mounts this arch's dylibs flat at /igloo/dylibs and the tools at /igloo/utils (per config_patchers.py) -- not at the container's /igloo_static/dylibs/. normalize_elf was setting the interpreter and RUNPATH to the container path, so on the guest the loader and libraries could not be found and the tools would not launch. Point both at /igloo/dylibs, and rewrite the python tree's internal references to /igloo/utils/python. The drop-in sysroot symlinks stay /igloo_static-relative on purpose: they are consumed at penguin *build* time (clang --sysroot), not on the guest. Verified armel: gdbserver interp -> /igloo/dylibs/ld-musl-arm.so.1, RUNPATH -> /igloo/dylibs. --- src/mk-arch-bundle.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mk-arch-bundle.nix b/src/mk-arch-bundle.nix index ebf1b50..d178d81 100644 --- a/src/mk-arch-bundle.nix +++ b/src/mk-arch-bundle.nix @@ -92,7 +92,10 @@ pkgs.runCommand "penguin-tools-${penguinArch}" interp="$(patchelf --print-interpreter "$source_ref" 2>/dev/null || true)" if [ -n "$interp" ]; then copy_dependency "$interp" - new_interp="/igloo_static/dylibs/$arch/$(basename "$interp")" + # These binaries run on the *guest*, where penguin mounts this arch's + # dylibs flat at /igloo/dylibs (see config_patchers.py). Use that path, + # not the container's /igloo_static/dylibs/. + new_interp="/igloo/dylibs/$(basename "$interp")" padded_interp="$(pad_interpreter "$new_interp" "$interp")" else padded_interp="" @@ -105,7 +108,7 @@ pkgs.runCommand "penguin-tools-${penguinArch}" copy_dependency "$resolved" done < <(patchelf --print-needed "$source_ref" 2>/dev/null || true) - patchelf --set-rpath "/igloo_static/dylibs/$arch" "$dest" 2>/dev/null || true + patchelf --set-rpath "/igloo/dylibs" "$dest" 2>/dev/null || true if [ -n "$interp" ]; then # MIPS targets are flaky when patchelf rewrites the interpreter path. @@ -256,7 +259,9 @@ pkgs.runCommand "penguin-tools-${penguinArch}" ;; copy:tree) stage_tree "$tool_path" "$arch_dir/$tool_name" - rewrite_text_refs "$tool_path" "/igloo_static/$arch/$tool_name" "$arch_dir/$tool_name" + # On the guest this tree is mounted at /igloo/utils/ (the arch + # dir maps to /igloo/utils), so rewrite its internal references there. + rewrite_text_refs "$tool_path" "/igloo/utils/$tool_name" "$arch_dir/$tool_name" ;; symlink:binary|symlink:tree) ln -sfn "$tool_link_target" "$arch_dir/$tool_name"