build_from_source
makes assumptions on internal Cargo details, breaking cargo-miri
with new build-dir
features · Issue #25 · RalfJung/rustc-build-sysroot (original) (raw)
Original report at rust-lang/cargo#14125 (comment)
miri (13e8790949 2025-05-04) fails to run with
$ cargo miri clean $ cargo miri test Preparing a sysroot for Miri (target: x86_64-unknown-linux-gnu)... fatal error: failed to build sysroot: failed to read cargo out dir Caused by: No such file or directory (os error 2)
when
[build] build-dir = "{cargo-cache-home}/build/{workspace-path-hash}" [unstable] build-dir=true
is set in
~/.cargo/config.toml
.After disabling these lines, miri can create the sysroot and works when these lines are reenabled.
The problem is
let out_dir = build_target_dir |
---|
.join(&target_name) |
.join(DEFAULT_SYSROOT_PROFILE) |
.join("deps"); |
According to the Cargo docs
Cargo also creates several other directories and files needed for the build process. Their layout is considered internal to Cargo, and is subject to change. Some of these directories are:
target/debug/deps/
With rust-lang/cargo#14125 (docs), users will be allowed to move deps
and many other directories out of target-dir
into their `build-dir of choice.
Our expectation is that we will eventually change the default location of build-dir
from target-dir
to {cargo-cache-home}/build/{workspace-path-hash}
.