rust-osdev/bootimage

Failed to run example-kernels

p-alik opened this issue · 3 comments

I run in an issue by the attempt to run example-kernels and hope to find help this way.
The cli cargo bootimage --target x86_64-bootimage-example-kernels.json finished successfully, but cargo xrun failed

✔ ~/git/github/rust-osdev/bootimage/example-kernels [master|✔] 
14:47 $ git log --oneline -n1
d590098 (HEAD -> master, origin/master, origin/HEAD) CI: Use choco to install QEMU 6.0.0
✔ ~/git/github/rust-osdev/bootimage/example-kernels [master|✔] 
14:47 $ cargo xrun --target x86_64-bootimage-example-kernels.json
WARNING: There is no root package to read the cargo-xbuild config from.
   Compiling core v0.0.0 (/home/XXX/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling compiler_builtins v0.1.49
   Compiling rustc-std-workspace-core v1.99.0 (/home/XXX/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
error[E0465]: multiple rmeta candidates for `core` found
 --> /home/XXX/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core/lib.rs:4:9
  |
4 | pub use core::*;
  |         ^^^^
  |
note: candidate #1: /tmp/cargo-xbuild0mSUnk/target/x86_64-bootimage-example-kernels/release/deps/libcore-8386ca77507e6ddc.rmeta
 --> /home/XXX/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core/lib.rs:4:9
  |
4 | pub use core::*;
  |         ^^^^
note: candidate #2: /tmp/cargo-xbuild0mSUnk/target/x86_64-bootimage-example-kernels/release/deps/libcore-cb62582e916e4b2a.rmeta
 --> /home/XXX/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core/lib.rs:4:9
  |
4 | pub use core::*;
  |         ^^^^

error: could not compile `rustc-std-workspace-core` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
error: `"/home/XXX/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo" "rustc" "-p" "alloc" "--release" "--manifest-path" "/tmp/cargo-xbuild0mSUnk/Cargo.toml" "--target" "x86_64-bootimage-example-kernels.json" "--" "-Z" "force-unstable-if-unmarked"` failed with exit code: Some(101)

Going to close the issue. Solved it by purging ~/.cargo directory and repeating the build procedure again.

Going to reopen the issue because it's unresolved.

Update of the crate x86_64 and removing of build-std solved the issue.

21:03 $ git diff .cargo/ basic/
diff --git a/example-kernels/.cargo/config.toml b/example-kernels/.cargo/config.toml
index 92cee48..37efe54 100644
--- a/example-kernels/.cargo/config.toml
+++ b/example-kernels/.cargo/config.toml
@@ -1,2 +1,2 @@
 [unstable]
-build-std = ["core", "compiler_builtins"]
+build-std-features = ["compiler-builtins-mem"]
diff --git a/example-kernels/basic/Cargo.toml b/example-kernels/basic/Cargo.toml
index 5a9a509..0beaadf 100644
--- a/example-kernels/basic/Cargo.toml
+++ b/example-kernels/basic/Cargo.toml
@@ -6,4 +6,4 @@ edition = "2018"
 
 [dependencies]
 bootloader = "0.9.7"
-x86_64 = "0.14.1"
+x86_64 = "0.14.6"
21:02 $ cargo xbuild --target  x86_64-bootimage-example-kernels.json
WARNING: There is no root package to read the cargo-xbuild config from.
   Compiling core v0.0.0 (/home/apastuchov/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling compiler_builtins v0.1.49
   Compiling rustc-std-workspace-core v1.99.0 (/home/apastuchov/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/tmp/cargo-xbuildfkpbyO)
    Finished release [optimized] target(s) in 13.45s
   Compiling bootloader v0.9.19
   Compiling x86_64 v0.14.6
   Compiling bit_field v0.10.1
   Compiling volatile v0.4.4
   Compiling bitflags v1.3.2
   Compiling rlibc v1.0.0
   Compiling runner-test v0.1.0 (/home/apastuchov/git/github/rust-osdev/bootimage/example-kernels/runner-test)
   Compiling runner-doctest v0.1.0 (/home/apastuchov/git/github/rust-osdev/bootimage/example-kernels/runner-doctest)
   Compiling runner-fail-reboot v0.1.0 (/home/apastuchov/git/github/rust-osdev/bootimage/example-kernels/runner-fail-reboot)
   Compiling basic v0.1.0 (/home/apastuchov/git/github/rust-osdev/bootimage/example-kernels/basic)
   Compiling runner v0.1.0 (/home/apastuchov/git/github/rust-osdev/bootimage/example-kernels/runner)
    Finished dev [unoptimized + debuginfo] target(s) in 2.08s

There is a thread regarding core and compiler_builtins in build-std
rust-lang/wg-cargo-std-aware#53