【问题标题】:how can i solve this error in rust cargo build-std? [closed]如何解决 rust cargo build-std 中的这个错误? [关闭]
【发布时间】:2022-01-11 10:31:28
【问题描述】:

我正在编写一个带有 rust 的操作系统,我已经在汇编中编写了引导加载程序。 但在 rust 中,我想使用不稳定的 build-std 功能。 我知道它需要访问rust-src。我已经使用rustup 安装了它。 我运行了这个命令: rustup component add rust-src 它给了我这个输出: 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

我该怎么办?

【问题讨论】:

  • 看起来它试图从您的包管理器中找到rust-src 而不是rustupwhich cargo 的输出是什么?您也可以尝试从包管理器安装rust-src:我相信sudo apt install rust-src (community.linuxmint.com/software/view/rust-src) 或卸载rust 并仅从rustup 使用:sudo apt uninstall rust。但欢迎提供有关如何安装 rust 的更多详细信息。

标签: rust rust-cargo


【解决方案1】:

你试过按照编译器说的做吗?

$ rustup component add rust-src

【讨论】:

  • 是的,正如我所说的,我做了两次。
  • 你在哪个发行版上?
  • linux mint with kde plasma
  • 你是通过包管理器还是使用他们提供的安装脚本安装 rust 的?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-11-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-01-31
相关资源
最近更新 更多