Compilation with Hermit dependency as part of a workspace fails
victor-dumitrescu opened this issue · comments
I have observed an issue where depending on Hermit in a crate that's part of a workspace makes compilation fail. For example, I can build a hello world crate where I specify
[target.'cfg(target_os = "hermit")'.dependencies.hermit]
version = "0.7.2"
default-features = false
using cargo build --target riscv64gc-unknown-hermit --release
. However, if this crate becomes part of a workspace (hermit-workspace
below), the build fails:
Building hermit-builtins
$ cargo build --release --manifest-path=hermit-builtins/Cargo.toml --target=riscv64gc-unknown-hermit -Zbuild-std=core -Zbuild-std-features=compiler-builtins-mem --target-dir /Users/victor/dev/hermit-workspace/target/riscv64gc-unknown-hermit/release/build/hermit-e893d51bcbd351c9/out/target
error: current package believes it's in a workspace when it's not:
current: /Users/victor/dev/hermit-workspace/target/riscv64gc-unknown-hermit/release/build/hermit-e893d51bcbd351c9/out/kernel-0.6.6/hermit-builtins/Cargo.toml
workspace: /Users/victor/dev/hermit-workspace/Cargo.toml
this may be fixable by adding `target/riscv64gc-unknown-hermit/release/build/hermit-e893d51bcbd351c9/out/kernel-0.6.6/hermit-builtins` to the `workspace.members` array of the manifest located at: /Users/victor/dev/hermit-workspace/Cargo.toml
Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package's manifest.
Error: command exited with non-zero code `cargo build --release --manifest-path=hermit-builtins/Cargo.toml --target=riscv64gc-unknown-hermit -Zbuild-std=core -Zbuild-std-features=compiler-builtins-mem --target-dir /Users/victor/dev/hermit-workspace/target/riscv64gc-unknown-hermit/release/build/hermit-e893d51bcbd351c9/out/target`: 101
thread 'main' panicked at /Users/victor/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hermit-0.7.2/build.rs:109:9:
assertion failed: status.success()
Crucially, I wasn't able to test any potential fixes to this because as soon as the hermit dependency is patched and cargo builds it locally or in .cargo/git/checkouts
instead of .cargo/registry/src/
the issue goes away.
Thanks for the issue! I'll publish a release later. 👍