blog_os
blog_os copied to clipboard
Could not compile with the latest rust toolchain
I wrote my code by following the blog, but I got a error when compiling.
Then I cloned the post-03
branch from this repository, I got the same error.
Compiling core v0.0.0 (E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\core)
Compiling compiler_builtins v0.1.73
Compiling rustc-std-workspace-core v1.99.0 (E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\rustc-std-workspace-core)
error[E0465]: multiple rmeta candidates for `core` found
--> E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\rustc-std-workspace-core\lib.rs:4:9
|
4 | pub use core::*;
| ^^^^
|
note: candidate #1: \\?\C:\Users\xtex\AppData\Local\Temp\cargo-xbuildl7B5Ms\target\x86_64-pc-windows-gnu\release\deps\libcore-87e8b19ea002f7b9.rmeta
--> E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\rustc-std-workspace-core\lib.rs:4:9
|
4 | pub use core::*;
| ^^^^
note: candidate #2: \\?\C:\Users\xtex\AppData\Local\Temp\cargo-xbuildl7B5Ms\target\x86_64-pc-windows-gnu\release\deps\libcore-b9677cb8d030ac16.rmeta
--> E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-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: `"\\\\?\\E:\\rust\\rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\bin\\cargo.exe" "rustc" "-p" "alloc" "--release" "--manifest-path" "C:\\Users\\xtex\\AppData\\Local\\Temp\\cargo-xbuildl7B5Ms\\Cargo.toml" "--target" "x86_64-pc-windows-gnu" "--" "-Z" "force-unstable-if-unmarked"` failed with exit code: Some(101)
rustc 1.64.0-nightly (7fe022f5a 2022-07-24)
Accoding to rust-lang/compiler-builtins#334#568784447, I removed line 2 in .cargo/config.toml
, the cargo compiled successfully but bootimage not working.
When I run cargo bootimage
without --target
, bootimage worked. However, I could not run it.
thread 'main' panicked at 'unexpected llvm-size line output', build.rs:156:39
Can you show the line that panics?
F:\Source\blog_os>cargo xbuild --target x86_64-blog_os.json
Compiling compiler_builtins v0.1.73
Compiling core v0.0.0 (E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\core)
Compiling rustc-std-workspace-core v1.99.0 (E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\rustc-std-workspace-core)
error[E0465]: multiple rmeta candidates for `core` found
--> E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\rustc-std-workspace-core\lib.rs:4:9
|
4 | pub use core::*;
| ^^^^
|
note: candidate #1: \\?\C:\Users\xtex\AppData\Local\Temp\cargo-xbuildz2StPJ\target\x86_64-blog_os\release\deps\libcore-f120d4a5aeeb3d70.rmeta
--> E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\rustc-std-workspace-core\lib.rs:4:9
|
4 | pub use core::*;
| ^^^^
note: candidate #2: \\?\C:\Users\xtex\AppData\Local\Temp\cargo-xbuildz2StPJ\target\x86_64-blog_os\release\deps\libcore-cdce86557829edc0.rmeta
--> E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-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: `"\\\\?\\E:\\rust\\rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\bin\\cargo.exe" "rustc" "-p" "alloc" "--release" "--manifest-path" "C:\\Users\\xtex\\AppData\\Local\\Temp\\cargo-xbuildz2StPJ\\Cargo.toml" "--target" "x86_64-blog_os.json" "--" "-Z" "force-unstable-if-unmarked"` failed with exit code: Some(101)
I do not know what is the line
you said.
The whole lib\rustlib\src\rust\library\rustc-std-workspace-core\lib.rs
is just four lines.
#![feature(no_core)]
#![no_core]
pub use core::*;
Could you do a cargo clean
and then try again?
I tried. Everytime I try to compile it, I delete the repository and clone it again.
F:\Source\blog_os>ls
Cargo.lock Cargo.toml LICENSE-APACHE LICENSE-MIT README.md bors.toml rust-toolchain src x86_64-blog_os.json
F:\Source\blog_os>cargo xbuild --target x86_64-blog_os.json
Compiling compiler_builtins v0.1.73
Compiling core v0.0.0 (E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\core)
Compiling rustc-std-workspace-core v1.99.0 (E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\rustc-std-workspace-core)
error[E0465]: multiple rmeta candidates for `core` found
--> E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\rustc-std-workspace-core\lib.rs:4:9
|
4 | pub use core::*;
| ^^^^
|
note: candidate #1: \\?\C:\Users\xtex\AppData\Local\Temp\cargo-xbuildx2wvMz\target\x86_64-blog_os\release\deps\libcore-f120d4a5aeeb3d70.rmeta
--> E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\rustc-std-workspace-core\lib.rs:4:9
|
4 | pub use core::*;
| ^^^^
note: candidate #2: \\?\C:\Users\xtex\AppData\Local\Temp\cargo-xbuildx2wvMz\target\x86_64-blog_os\release\deps\libcore-cdce86557829edc0.rmeta
--> E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-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: `"\\\\?\\E:\\rust\\rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\bin\\cargo.exe" "rustc" "-p" "alloc" "--release" "--manifest-path" "C:\\Users\\xtex\\AppData\\Local\\Temp\\cargo-xbuildx2wvMz\\Cargo.toml" "--target" "x86_64-blog_os.json" "--" "-Z" "force-unstable-if-unmarked"` failed with exit code: Some(101)
F:\Source\blog_os>cargo clean
F:\Source\blog_os>cargo xbuild --target x86_64-blog_os.json
Compiling core v0.0.0 (E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\core)
Compiling compiler_builtins v0.1.73
Compiling rustc-std-workspace-core v1.99.0 (E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\rustc-std-workspace-core)
error[E0465]: multiple rmeta candidates for `core` found
--> E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\rustc-std-workspace-core\lib.rs:4:9
|
4 | pub use core::*;
| ^^^^
|
note: candidate #1: \\?\C:\Users\xtex\AppData\Local\Temp\cargo-xbuildWOfpjg\target\x86_64-blog_os\release\deps\libcore-cdce86557829edc0.rmeta
--> E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\rustc-std-workspace-core\lib.rs:4:9
|
4 | pub use core::*;
| ^^^^
note: candidate #2: \\?\C:\Users\xtex\AppData\Local\Temp\cargo-xbuildWOfpjg\target\x86_64-blog_os\release\deps\libcore-f120d4a5aeeb3d70.rmeta
--> E:\rust\rustup\toolchains\nightly-x86_64-pc-windows-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: `"\\\\?\\E:\\rust\\rustup\\toolchains\\nightly-x86_64-pc-windows-gnu\\bin\\cargo.exe" "rustc" "-p" "alloc" "--release" "--manifest-path" "C:\\Users\\xtex\\AppData\\Local\\Temp\\cargo-xbuildWOfpjg\\Cargo.toml" "--target" "x86_64-blog_os.json" "--" "-Z" "force-unstable-if-unmarked"` failed with exit code: Some(101)
F:\Source\blog_os>
Currently cargo 1.65.0-nightly (4fd148c47 2022-08-03) rustc 1.65.0-nightly (2befdefdd 2022-08-06) rustup 1.25.1 (bb60b1e89 2022-07-12)
The post-03
code has a .cargo/config.toml
file that enables cargo's build-std
feature, so cargo-xbuild
is no longer needed. Could you try to run just cargo build
?
Yeah, it works, please update the documentation.
Great to hear that!
please update the documentation.
Which documentation do you mean? The Readme in the post-03
branch already describes the build process using cargo build
and the blog at https://os.phil-opp.com/ is not using cargo-xbuild
anymore either.
Oh the Chinese translations, I commented there.
Thanks!