`xargo build` 找不到库

`xargo build` cannot find library

所以我正在关注 this tutorial 如何使用 Rust 编程语言创建一个非常基本的操作系统。 (我打算购买一本关于该主题的实际书籍,但我现在正在使用它)。

以下是我们创建的一些文件,只是为了澄清一些事情:

Cargo.toml

[package]
name = "blog_os"
version = "0.1.0"
authors = ["Philipp Oppermann <dev@phil-opp.com>"]   # Here I used my own details

[lib]
crate-type = ["staticlib"]

src/lib.rs

#![feature(lang_items)]
#![no_std]

#[no_mangle]
pub extern fn rust_main() {}

#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "panic_fmt"] #[no_mangle] pub extern fn panic_fmt() -> ! {loop{}}

x86_64-blog_os.json

{
  "llvm-target": "x86_64-unknown-none",
  "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
  "linker-flavor": "gcc",
  "target-endian": "little",
  "target-pointer-width": "64",
  "target-c-int-width": "32",
  "arch": "x86_64",
  "os": "none",
  "disable-redzone": true,
  "features": "-mmx,-sse,+soft-float"
}

如果您向下滚动到教程中的 编译 部分,作者向我们展示了如何安装 xargo 以及如何将其用于 build .

然后我们被要求 运行:

> xargo build --target=x86_64-blog_os

但是当我这样做时,我收到以下错误消息:

error: failed to parse manifest at '/home/max/TesterOS/src/Cargo.toml'

Caused by:
  can't find library 'blog_os', rename file to 'src/lib.rs' or specify lib.path

问题是否与我保存文件的位置有关?因为我是严格按照教程来的,但是作者并没有具体说明所有东西应该保存在哪里。

已解决:原来这实际上与我放置文件的位置有关。

我必须创建一个 blog_os 文件夹并将我的文件存储在其中。因此错误:

can't find library 'blog_os'....

菜鸟错误:)