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
I have a no_std crate which depends on another crate, arrayvec. arrayvec only uses std if the corresponding crate feature is enabled (which is on by default). I disable its default features in my crate's Cargo.toml, which should make it no_std.
My crate additionally has a build-dependency on nasm-rs which itself depends on arrayvec. It uses the default features, meaning nasm-rs's arrayvec should use std.
I'm finding that this combination makes my build fail. Cargo attempts to use arrayvec with std in my normal build.
I expected Cargo to build arrayvec without default features in the main build, and with default features for build.rs. It seems to be combining the feature sets instead.
Compiling arrayvec v0.5.1
error[E0463]: can't find crate for `std`
|
= note: the `i686-unknown-none-4984653564076209026` target may not be installed
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: could not compile `arrayvec`
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
Comment out dependency nasm-rs:
...
[build-dependencies]
# Commenting out this dependency makes the build succeed.
# nasm-rs = "0.2.0"
Observe successful build:
$ cargo build
Compiling arrayvec v0.5.1
Compiling build-dep-failure-repro v0.1.0 (/home/collin/development/build-dep-failure-repro)
Finished dev [unoptimized + debuginfo] target(s) in 0.26s
Possible Solution(s)
Notes
Output of cargo version:
cargo 1.48.0-nightly (75615f8 2020-09-29)
I'm using a custom build target which might be part of the problem.
The text was updated successfully, but these errors were encountered:
Thanks for making the repro! There is an nightly-only feature (-Zfeatures=host_dep) which will decouple the features from build-dependencies. You can read about it in the docs and follow the tracking issue (#7915) for updates.
Uh oh!
There was an error while loading. Please reload this page.
Problem
I have a no_std crate which depends on another crate, arrayvec. arrayvec only uses
std
if the corresponding crate feature is enabled (which is on by default). I disable its default features in my crate's Cargo.toml, which should make it no_std.My crate additionally has a build-dependency on nasm-rs which itself depends on arrayvec. It uses the default features, meaning nasm-rs's arrayvec should use
std
.I'm finding that this combination makes my build fail. Cargo attempts to use arrayvec with
std
in my normal build.I expected Cargo to build arrayvec without default features in the main build, and with default features for build.rs. It seems to be combining the feature sets instead.
A crate that repros this error: https://github.com/chbaker0/build-dep-failure-repro
Steps
Possible Solution(s)
Notes
Output of
cargo version
:cargo 1.48.0-nightly (75615f8 2020-09-29)
I'm using a custom build target which might be part of the problem.
The text was updated successfully, but these errors were encountered: