【问题标题】:`xargo build` cannot find library`xargo build` 找不到库
【发布时间】:2017-12-30 16:25:36
【问题描述】:

所以我正在关注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

问题与我保存文件的位置有关吗?因为我完全按照教程进行操作,但作者并没有具体说明应该保存所有内容的位置。

【问题讨论】:

    标签: rust rust-cargo


    【解决方案1】:

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

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

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

    菜鸟错误:)

    【讨论】:

      猜你喜欢
      • 2019-09-11
      • 1970-01-01
      • 2019-06-13
      • 2019-12-23
      • 2013-11-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-31
      相关资源
      最近更新 更多