Closed VictorKoenders closed 3 years ago
cstr_core
shouldn't cause std
to be picked up by default. You should disable the use_libc
feature to avoid picking up std
.
Oh it seems to be an issue with including bindgen
Cargo.toml
[package]
name = "test_"
version = "0.1.0"
authors = ["Trangar <victor.koenders@gmail.com>"]
edition = "2018"
[dependencies]
[dependencies.cstr_core]
version = "*"
default-features = false
[build-dependencies]
bindgen = "*"
lib.rs
#![no_std]
extern crate cstr_core;
pub extern "C" fn foo(){}
Output
trangar@trangar-home:~/development/rust/test$ cargo build --target riscv32i-unknown-none-elf
Compiling memchr v2.3.3
error[E0463]: can't find crate for `std`
|
= note: the `riscv32i-unknown-none-elf` target may not support the standard library
= note: `std` is required by `memchr` because it does not declare `#![no_std]`
= help: consider building the standard library from source with `cargo build -Zbuild-std`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: could not compile `memchr`
To learn more, run the command again with --verbose.
I guess this is a limitation with Cargo?
That shouldn't be happening...
Can you try adding resolver = "2"
to the [package]
section to see if this fixes the problem?
Oh today I learned about resolver
, that seems to solve it. Thanks!
I have to use resolver = "2"
as well. Even with edition 2021. Any idea why?
You need to specify a resolver in the 2021 edition if you use a virtual Cargo workspace.
I love cstr_core, however in every embedded project I try to use it, the
memchr
dependency tries to pull instd
and it fails.I'm not sure why it does this, the
use_libc
feature should fix this but it doesn't. This compiles:And this doesn't:
Since
memchr
is only used in 2 places, and in my usecase I don't need the performance increase, it would be nice if I could completely disable thememchr
dependency.