You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Rust内核项目添加依赖报错:无法解析Cargo.toml

Rust内核项目添加依赖后cargo make报错问题

背景

  • 基于Rust编写小型OS内核,跟随Phil Opperman博客扩展简易文件系统,当前需实现磁盘写入中断功能,需引入PIC8259相关crate
  • 项目结构:根crate + 独立管理依赖的kernel子crate,所有修改集中在kernel crate,通过根目录Makefile执行cargo make启动程序

报错信息

在kernel/Cargo.toml中添加新依赖后,触发如下错误:

thread 'main' panicked at 'Unable to parse Cargo.toml, cargo metadata exited with an error: warning: profiles for the non root package will be ignored,
package: /buzz/kernel/Cargo.toml
workspace: /buzz/Cargo.toml
Updating crates.io index
', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/cargo-make-0.36.4/src/lib/environment/crateinfo.rs:277:27

已尝试的排查动作

  • 最初认为是profile配置警告导致,将kernel crate的profile设置迁移到根Cargo.toml,警告消失但错误仍存在
  • 同事同结构项目中,profile配置放在kernel/Cargo.toml可正常运行,排除该配置本身问题
  • 尝试获取堆栈跟踪,未得到有效线索
  • 测试添加任意crate都会触发错误(原项目已有其他依赖可正常工作)
  • 更换网络环境,问题未解决

补充信息

kernel/Cargo.toml完整内容

[package]
name = "buzz-os-kernel"
version = "0.1.0"
edition = "2018"

[dependencies]
volatile = "0.2.6" # Volatile allows finer grain control of the compiler
spin = "0.5.2"
bitflags = "1.0.4"
pic8259_x86 = "0.1.0"

[dependencies.lazy_static]
version = "1.0"
features = ["spin_no_std"]

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

[profile.dev]
panic = "abort"
debug = true
debuginfo = "stabs"
  • 尝试引入的pic8259_x86是Opperman所用pic8259 crate的修改版本,但添加任何crate都会触发相同错误

关键观察

单独执行cargo metadata命令时,进度走到25.97%后被标记为“killed”,每次均是如此;运行环境为Docker容器,怀疑是内存不足导致进程被系统终止

内容的提问来源于stack exchange,提问作者Hayden Rieder

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 22:28:09