-
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
Spurious cargo build
error from a combination of binary dependencies, the lib
key, the target
key, and differing crate features
#10837
Comments
Just did a simple investigation. It seems that if you set |
After the investigation, I guess the root cause was found. In this reproducer, the dependency graph is a bit complex:
To generalize the scenario, let's put it in this way:
This is nothing to do with host target. It always fails when the user requests the same # cargo.toml
wasmtime-environ = { path = "wasmtime-environ", lib = true, artifact = "bin" , target = "wasm32-wasi" }
# console
$ cargo b -Zbindeps --target wasm32-wasi For #10525, I have yet looked into it, though I believe it is in a similar situation that |
@weihanglo You're a hero for investigating these! |
This is a unit test reproducing the bindep transitive dependency bug based upon examples from - rust-lang#10837 - rust-lang#11463 Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
This is a unit test reproducing the bindep transitive dependency bug based upon examples from - rust-lang#10837 - rust-lang#11463 Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
This is a unit test reproducing the bindep transitive dependency bug based upon examples from - rust-lang#10837 - rust-lang#11463 Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
This is a unit test reproducing the bindep transitive dependency bug based upon examples from - rust-lang#10837 - rust-lang#11463 Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Problem
Similar to #10525, here's another tricky bindeps-related error distilled from a real-world codebase. Once again, the bug has been aggressively minimized and the reproduction contains no remote code at all, although crate names, feature names, function names, etc have been preserved for familiarity. Despite some similarities to #10525, this exhibits a few differences which lead me to suspect that it may be a different bug. It's still entirely possible that a fix for one will fix the other, but if nothing else this will make for a good test case. In particular:
lib
dependency key. Removing this key causes the error to vanish.cargo build
, and interestingly does not arise duringcargo check
!Otherwise, the similarities to #10525:
target
key, in this casetarget = "x86_64-unknown-linux-gnu"
, which should be a no-op since my host platform is alreadyx86_64-unknown-linux-gnu
, so the exact same artifact should be built regardless. Removing this key causes the error to vanish. (This is also a property of several other bugs, e.g. Binary dependency is never built if specified with bothoptional
andtarget
keys #10526 ).alloc
feature in mycrate's dependency on serde; removing this no-op feature causes the error to vanish.There's not very much code to the reproduction, but it is multiple crates. For easier understanding, here's an overview of the dependency graph:
For convenience, a copy of the minimized repro can be found here: https://github.com/bstrie/bindeperror5 , while for posterity the repro is also inlined at the bottom of this issue. The maximized, original reproduction can be found here: https://github.com/bstrie/enarx/tree/bindeperror5 (you will need to compile with
cargo build --target x86_64-unknown-linux-musl
to trigger it).The code in question should compile. Instead,
cargo build
produces the following error:Any of the modifications mentioned above will cause this error to vanish.
Output of
cargo version --verbose
:Code for reference:
// src/lib.rs
The text was updated successfully, but these errors were encountered: