Skip to content

Commit f6fe850

Browse files
bkchrnbp
authored andcommitted
Fix SYSROOT detection on latest nightly
Rust changed the way the SYSROOT is determined in: rust-lang/rust#103660 Before this change the SYSROOT was determined based on the rustc executable. Now it is determined based on the librustc_driver-*.so file. This pr fixes the detection by copying the library to the derivation as we have done it for the rustc executable.
1 parent d38863d commit f6fe850

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

rust-overlay.nix

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,20 @@ let
288288
if [ -e $target ]; then
289289
cp --remove-destination "$(realpath -e $target)" $target
290290
fi
291+
292+
# The SYSROOT is determined by using the librustc_driver-*.so.
293+
# So, we need to point to the *.so files in our derivation.
294+
chmod u+w $target
295+
patchelf --set-rpath "$out/lib" $target || true
291296
done
297+
298+
# Here we copy the librustc_driver-*.so to our derivation.
299+
# The SYSROOT is determined based on the path of this library.
300+
if ls $out/lib/librustc_driver-*.so &> /dev/null; then
301+
RUSTC_DRIVER_PATH=$(realpath -e $out/lib/librustc_driver-*.so)
302+
rm $out/lib/librustc_driver-*.so
303+
cp $RUSTC_DRIVER_PATH $out/lib/
304+
fi
292305
'';
293306

294307
# Export the manifest file as part of the nix-support files such

0 commit comments

Comments
 (0)