-
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
Crash when using per-package-target
and build-std
#11898
Comments
Might be a bit related I guess: #10444. |
Interestingly I was just experimenting with the |
Sorry I didn't really look deeply into this issue. Just got the impression that there are some more panics around target platforms interacting with |
Definitely looks like the same root cause, just manifesting in a different situation in this case. Feel free to close as a dupe if that makes sense :) I appreciate the prompt response! |
Forgot I made this issue; I have some more information here: #9406 (comment) |
Actually, I think I might have found the issue. If I'm understanding correctly, the std roots that are available for attachment (and are later attached based on the force_target setting) are enumerated beforehand. However, those don't include any additional Thus, the cargo/src/cargo/ops/cargo_compile/mod.rs Lines 345 to 352 in d7d48e4
If that can somehow be extended to include any additional EDIT: Sure enough, it only includes what's on
|
Man, yeah. This feature is really half-baked, it seems :( I went ahead based on my last findings and did the following: diff --git a/src/cargo/ops/cargo_compile/mod.rs b/src/cargo/ops/cargo_compile/mod.rs
index 04ebe7d..bfb36f5 100644
--- a/src/cargo/ops/cargo_compile/mod.rs
+++ b/src/cargo/ops/cargo_compile/mod.rs
@@ -342,7 +342,7 @@ pub fn create_bcx<'a, 'cfg>(
// assuming `--target $HOST` was specified. See
// `rebuild_unit_graph_shared` for more on why this is done.
let explicit_host_kind = CompileKind::Target(CompileTarget::new(&target_data.rustc.host)?);
- let explicit_host_kinds: Vec<_> = build_config
+ let mut explicit_host_kinds: Vec<_> = build_config
.requested_kinds
.iter()
.map(|kind| match kind {
@@ -351,6 +351,9 @@ pub fn create_bcx<'a, 'cfg>(
})
.collect();
+ explicit_host_kinds.push(CompileKind::Target(CompileTarget::new("<snip>/triple/x86_64.json").unwrap()));
+ explicit_host_kinds.push(CompileKind::Target(CompileTarget::new("<snip>/triple/x86.json").unwrap()));
+
// Passing `build_config.requested_kinds` instead of
// `explicit_host_kinds` here so that `generate_root_units` can do
// its own special handling of `CompileKind::Host`. It will It did proceed to compile, but then Cargo detected different target types and blew up:
Seems Cargo just isn't set up for multi-target building like this? I think a proper implementation of this feature is going to require a lot more than a few clever TOML manifest additions :/ This is where I'm going to leave it for now. Hopefully someone much more knowledgeable with the codebase than I am can figure this out. For now, it seems that |
Problem
Reproduction case: https://github.com/Qix-/cargo-crash-repro-2023-3-28
When using the
per-package-target
unstable feature along withbuild-std
et al, cargo crashes with a panic.Panic backtrace
Steps
--target
to your host's triple, not sure)Possible Solution(s)
No response
Notes
No response
Version
The text was updated successfully, but these errors were encountered: