Error when executing "cargo xbuild target x86_64 blog_os.json" in "A Minimal Rust Kernel" - LearningOS/rcore_step_by_step GitHub Wiki
执行
cargo xbuild --target x86_64-blog_os.json
出现错误
error: failed to resolve patches for `https://github.com/rust-lang/crates.io-index`
Caused by:
failed to load source for a dependency on `rustc-std-workspace-core`
Caused by:
Unable to update /Users/.../.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src/tools/rustc-std-workspace-core
Caused by:
failed to read `/Users/.../.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src/tools/rustc-std-workspace-core/Cargo.toml`
Caused by:
No such file or directory (os error 2)
error: `"cargo" "rustc" "-p" "alloc" "--release" "--manifest-path" "/var/folders/04/0ycqvr6d2rz8hn48t7y1w72r0000gn/T/xargo.sU3OCFevT8sa/Cargo.toml" "--target" "x86_64-blog_os.json" "--" "-Z" "force-unstable-if-unmarked"` failed with exit code: Some(101)
note: run with `RUST_BACKTRACE=1` for a backtrace
执行
rustc --version
输出
rustc 1.33.0-nightly (9eac38634 2018-12-31)
错误原因是 rustc 没有更新。于是使用 rustup 更新
rustup install nightly
然后切换默认工具链
rustup default nightly-x86_64-apple-darwin
输出
info: using existing install for 'nightly-x86_64-apple-darwin'
info: default toolchain set to 'nightly-x86_64-apple-darwin'
nightly-x86_64-apple-darwin unchanged - rustc 1.34.0-nightly (350674b71 2019-02-28)
rustc 版本更新为
rustc 1.34.0-nightly (350674b71 2019-02-28)
这时再次执行
cargo xbuild --target x86_64-blog_os.json
得到正常输出
Compiling array-init v0.0.4
Compiling xmas-elf v0.6.2
Compiling libc v0.2.49
Compiling pulldown-cmark v0.0.3
Compiling rand v0.4.6
Compiling tempdir v0.3.7
Compiling skeptic v0.5.0
Compiling fixedvec v0.2.3
Compiling x86_64 v0.3.6
Compiling bootloader v0.3.14
Compiling xy_os v0.1.0 (/Users/...)
Finished dev [unoptimized + debuginfo] target(s) in 7.46s