-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for "cargo vendor" broke -Zbuild-std for custom targets. Or at least, the current behavior is now different #8945
Comments
The changes to |
What does that mean? When working with custom targets, cargo is already very well aware of the following two locations:
It is aware of those because when the custom target is build (e.g.
... where the custom target root is So to summarize Cargo does have access to the Why are the Sounds like a bug to me? |
Yes I believe your diagnosis of the situation is all correct, and this is due to changes in #8834. Cargo doesn't expect the rustc-std-workspace crates to be in vendor themselves, but it's expecting the copies from crates.io is vendored in there, since that's what It's not clear if this should be a bug for Cargo to fix or a bug for rust-lang/rust and/or rustup to have an extra step when you create a local toolchain. |
I'm going to close this as it has been reverted in #8968. Will continue tracking in rust-lang/wg-cargo-std-aware#23. |
(Disclaimer: Rust noob here. Don't kill me if I've misinterpreted a correct behaviour.)
Problem
Building a crate with
-Zbuild-std=...
and--target <target>
where<target>
is a custom target linked in Rustup like this (rustup link mytarget /...path.../
) is broken since approx the time when the changes for "cargo vendor" landed.Steps
cargo build -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort
error: could not read vendor path
. Apparently, because of this code on line 55.... which is due to the fact that cargo does not pick up the std lib from the sysroot of the custom target at all. An indication of that is the fact that it downloads and compiles the
rustc-std-workspace-*
crates from GitHub rather than picking up their patches from the sysroot of the custom target. I.e. when run with--verbose
:Apparently, the above is caused by the logic here (line 67 and onward), but I've not analyzed (yet) what needs to be fixed in detail.
Possible Solution(s)
The following workaround seems to fix the issue:
cd rust
mkdir vendor
cd vendor
ln -s ../library/rustc-std-workspace-alloc rustc-std-workspace-alloc
ln -s ../library/rustc-std-workspace-core rustc-std-workspace-core
ln -s ../library/rustc-std-workspace-std rustc-std-workspace-std
Yet, this just does not feel right.
I just want to use my custom target with
-Zbuild-std
and that's it. Ideally, I should not be even aware of thevendor
machinery, let alone symlinking the rustc-std-workspace-* patch crates in there.Or is this how it all is supposed to work with custom targets, now that
cargo vendor
has landed?The text was updated successfully, but these errors were encountered: