Given the thumbv7em-none-eabihf
target installed,
$ rustup target add thumbv7em-none-eabihf
and the following in Cargo.toml,
[dependencies]
heapless = "0.5.1"
[dev-dependencies]
bindgen = "0.52.0"
an empty #![no_std]
lib (there's really nothing else!) doesn't compile:
$ cargo build --target=thumbv7em-none-eabihf
Compiling byteorder v1.3.2
error[E0463]: can't find crate for `std`
|
= note: the `thumbv7em-none-eabihf` target may not be installed
It compiles fine if I comment out any of these two dependencies, however. If I understand correctly, the issue is that both bindgen
and heapless
indirectly depend on byteorder
of different versions (std vs no-std):
$ cargo tree
โโโ heapless v0.5.1
. . .
โโโ hash32 v0.1.1
โโโ byteorder v1.3.2 <- this is default-features = false
[dev-dependencies]
โโโ bindgen v0.52.0
. . .
โโโ rustc-hash v1.0.1
โ โโโ byteorder v1.3.2 (*) <- but this includes std
. . .
The only way I found to resolve this is to vendor the byteorder
crate and disable its default feature:
# Cargo.toml
[features]
-default = ["std"]
+default = []
- Is there a better way (i.e. without vendoring any crates to me)?
- Is this error expected?