Skip to content

Commit 4ec0caf

Browse files
build(depends): fail native_rust staging in Guix when a runtime library is missing
Inside a Guix environment there are no default loader search paths, so a toolchain staged without libgcc_s/libz next to it is nonfunctional and would be cached in that state. Treat a missing required runtime library as a staging failure there, consistent with the existing fatal patchelf check; outside Guix it remains a warning since the system loader can still resolve the libraries.
1 parent 0a58c0d commit 4ec0caf

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

‎depends/patches/native_rust/fix-elf-interpreter.sh‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,20 @@ export LC_ALL=C
88
LIBDIR="$1"
99
shift
1010

11+
in_guix_env() {
12+
case "$(command -v ls)" in
13+
/gnu/store/*) return 0 ;;
14+
esac
15+
return 1
16+
}
17+
1118
if ! command -v patchelf >/dev/null 2>&1; then
1219
# Inside a Guix environment the prebuilt binaries cannot run without
1320
# having their interpreter patched, so a missing patchelf is fatal there.
14-
case "$(command -v ls)" in
15-
/gnu/store/*)
16-
echo "ERROR: patchelf is required inside the Guix environment but was not found" >&2
17-
exit 1
18-
;;
19-
esac
21+
if in_guix_env; then
22+
echo "ERROR: patchelf is required inside the Guix environment but was not found" >&2
23+
exit 1
24+
fi
2025
echo "patchelf not found, skipping ELF fix"
2126
exit 0
2227
fi
@@ -68,6 +73,14 @@ for libname in libgcc_s.so.1 libz.so.1; do
6873
echo "Copying $libname from: $LIB_REAL"
6974
cp "$LIB_REAL" "$LIBDIR/$libname"
7075
else
76+
# Outside Guix the loader can still resolve these from the default
77+
# system search paths; inside Guix there are none, so a toolchain
78+
# missing one of these libraries is nonfunctional and must not be
79+
# staged and cached.
80+
if in_guix_env; then
81+
echo "ERROR: $libname is required inside the Guix environment but was not found" >&2
82+
exit 1
83+
fi
7184
echo "WARNING: Could not find $libname to copy"
7285
fi
7386
done

0 commit comments

Comments
 (0)