QuarkContainer / Quark

A secure container runtime with CRI/OCI interface
Apache License 2.0
324 stars 49 forks source link

toolchain: enable using cargo's own build-std #1308

Closed shrik3 closed 5 months ago

shrik3 commented 5 months ago

we need to build the toolchain because qkernel (arch-qkernel.json) is not one of the default targets. We have been using the cargo-xbuild tool for this and it worked fine, however it's not under active maintance for ~ 2 years and there could be some issues with newer rust toolchain as of May, 2024.

Rust's build-std is a unstable feature that does the same thing: we tell it to build the components e.g. core, alloc, builtins ... in the .cargo/config.toml so that cargo builds them with the custom target specified by --target xyz.json. To use this, simply replace the cargo xbuild with cargo build in qkernel's makefile, nothing else needs to change. (this approach is also noted in cargo-xbuild's docs)

Since cargo xbuild is not breaking (yet) and the build-std is not a unstable feature (yet), I'm keeping the cargo-xbuild as default. The build-std could opt-in if needed.

shrik3 commented 5 months ago

the first commit simply adds a config file, it has no impact on the xbuild. in case something breaks, simply revert the second commit.

shrik3 commented 5 months ago

Tested. No issue found.

thanks. I'll update the readme to remove the xbuild dependency later.