简体   繁体   English

如何解决 rust cargo build-std 中的这个错误?

[英]how can i solve this error in rust cargo build-std?

i am writing an os with rust, i already wrote the bootloader in assembly.我正在用 rust 编写一个操作系统,我已经在汇编中编写了引导加载程序。 but in rust, i want to use the unstable build-std feature.但在 rust 中,我想使用不稳定的 build-std 功能。 i know it needs access to rust-src .我知道它需要访问rust-src i have already installed it using rustup .我已经使用rustup安装了它。 i ran this command: rustup component add rust-src and it gave me this output: info: component 'rust-src' is up to date but when i try to compile the code using cargo, it gives me this error:我运行了这个命令: rustup component add rust-src它给了我这个 output: info: component 'rust-src' is up to date但是当我尝试使用 cargo 编译代码时,它给了我这个错误:

error: "/usr/lib/rustlib/src/rust/Cargo.lock" does not exist, unable to build with the standard library, try:
        rustup component add rust-src

what should i do?我应该怎么办?

Have you tried doing as the compiler says?您是否尝试过按照编译器的说明进行操作?

$ rustup component add rust-src

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM