Closed Momijiichigo closed 10 months ago
Blog os required bootloader 0.9. It doesn't work with any later version of the bootloader crate as these rework the way building disk images is done.
Blog os required bootloader 0.9. It doesn't work with any later version of the bootloader crate as these rework the way building disk images is done.
they are following the draft of edition 3 which uses 0.11
I see. I think this is a cargo bug in the bin deps feature. I would guess it unified features between the kernel itself and the crate that builds the disk image.
For what it is worth, I have also been toying around with something akin to what is in the edition 3 branch. Here's my rust-toolchain.toml file from the root of my workspace. (Note: I'm on an arm macbook, as such I cannot remember if the target also needs to be specified here or not):
[toolchain]
channel = "nightly-2023-04-03"
components = ["rust-src", "llvm-tools-preview", "rustfmt", "clippy"]
targets = ["x86_64-unknown-none"]
I suspect the part that is really worth sticking onto is the nightly version.
EDIT: Also my Cargo.toml workspace file is using package.resolver = "2"
.
@kastermester Thank you so much!!!
Adding resolver = "2"
in the Cargo.toml solved the problem!! I never thought about that!!
@Momijiichigo I would also recommend adding a kernel/.cargo/config.toml
and specifying the following, to make everything a bit easier to reproduce:
[unstable]
build-std = ["core", "compiler_builtins"]
[build]
target = "x86_64-unknown-none"
It's also worth considering pinning a specific nightly version in your toolchain file, and specifying your targets:
[toolchain]
channel = "nightly-2023-09-04"
components = ["rust-src", "llvm-tools-preview"]
targets = ["x86_64-unknown-none"]
Both of these make it a bit more reliable for others cloning your repo to reproduce your environment.
@torrancew thanks for the advice! Now I'm closing this issue since it's resolved
As an alternative to resolver = "2"
, you can also set edition = "2021"
where the new resolver is the default. You already set the edition for your sub-crates, but not for the root crate.
I also wrote the details of this problem in this GitHub issue comment: https://github.com/rust-lang/cargo/issues/11772#issuecomment-1705900313
Error
The compiler throws error while compiling
kernel
, saying a dependencyserde
uses std whilekernel
is no_std:Info
kernel
isno_std
bindep artifact dependency, targetingx86_64-unknown-none
bootloader-x86_64-common
,Steps to reproduce error
cargo build
Comment
I don't know if this is a problem with cargo, but I posted this issue here just in case so that hopefully anyone here might be familiar with this problem and have solutions