You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cargo careful test fails to run unit tests for proc-macro crates since rust-lang/rust@887804d5686
The test executable is compiled successfully,
but the dynamic loader cannot find the libstd built by cargo-careful:
Running unittests src/lib.rs (target/debug/build/pm-repro/e6767d554e5978c6/out/pm_repro-e6767d554e5978c6).../pm_repro-e6767d554e5978c6: error while loading shared libraries: libstd-120c9d4d8f02a466.so: cannot open shared object file: No such file or directoryerror: test failed, to rerun pass `--lib`
cargo-careful seems to use https://crates.io/crates/rustc_build_sysroot to build a custom std
and invokes Cargo with --sysroot <careful-sysroot>.
The actual test binary is linked against the custom libstd from cargo-careful sysroot, hence the failure.
Respect custom rustflags, though we then need to think about target rustflags and host rustflags interacdtion, which is a bit annoying. Otherwise we couldn't cover below settings.
Problem
cargo careful testfails to run unit tests for proc-macro crates since rust-lang/rust@887804d5686The test executable is compiled successfully,
but the dynamic loader cannot find the
libstdbuilt by cargo-careful:This is likely due to #17276.
Before that PR,
Cargo probed
--print=sysrootas part of the target probe, which passed custom rustflags to the probing invocation:rustc <rustflags> [--target <target>] --print=sysroot ...After, it became a plain
rustc --print=sysrootcargo-careful seems to use https://crates.io/crates/rustc_build_sysroot to build a custom std
and invokes Cargo with
--sysroot <careful-sysroot>.The actual test binary is linked against the custom libstd from cargo-careful sysroot, hence the failure.
Steps
Possible Solution(s)
A few options in my mind:
Revert refactor: move sysroot lookup to GlobalContext #17276
Respect custom rustflags, though we then need to think about target rustflags and host rustflags interacdtion, which is a bit annoying. Otherwise we couldn't cover below settings.
Notes
Original downstream report: RalfJung/cargo-careful#55
Version