Build-std in cargo.toml is ignored when building
graykevinb opened this issue · comments
Book Section: Minimal Rust Kernel
Problem: Even after setting up build-std in Cargo.toml rust build ignores build-std and produces an error. I did add rust-src and it was already installed.
Version: rustc 1.72.0-nightly (d59363ad0 2023-06-01)
cargo build --target x86_64-blog_os.json
results in the error:
Compiling blog_os v0.1.0 (/home/kgray/blog_os)
error[E0463]: can't find crate for core
Workaround:
We can specify which crates to compile with the -Z flag.
cargo build -Z build-std=core,compiler_builtins --target x86_64-target.json
Oddly enough the compiler complains that the [unstable] manifest key is unused.
The instructions specified in the book are correct and consistent with the documentation. Thus this is really an issue with rust nightly. However, I wanted to document how I overcame this issue here. If I create a bug report for rust, I will link it here.
The [unstable]
table should not be part of the Cargo.toml
. You need to put it in a new cargo configuration file named .cargo/config.toml
.
Thank you! I see now that it says that. Closing out.