-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
A-featuresArea: features — conditional compilationArea: features — conditional compilation
Description
Sorry about the title, this one was hard for me to nail down.
I'm working on a project (embedded, no_std) that relies on both bindgen
as a build-dependency and libc
as a dependency. When I set default-features = false
in Cargo.toml for libc
, the use of bindgen
(which depends upon libc
) influences the features enabled in libc
when building for the target. To wit:
[package]
...
[build-dependencies]
bindgen = "0.26.3"
[dependencies.libc]
version = "0.2"
default-features = false
When bindgen
is specified as a build-dependency, the libc
crate is built with the command line:
rustc --crate-name libc /Users/bmatt/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.29/src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 --cfg feature="default" --cfg feature="use_std" -C metadata= ...`
this fails for want of std
, namely error[E0463]: can't find crate for 'std'
.
When bindgen is removed, the libc
crate is build with the command line:
rustc --crate-name libc /Users/bmatt/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.29/src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=...
this fails for reasons related to missing types (which appears to be a bug in libc
?), e.g. error[E0412]: cannot find type
c_char in this scope
.
Metadata
Metadata
Assignees
Labels
A-featuresArea: features — conditional compilationArea: features — conditional compilation