diff options
| author | Paul Lietar <pl2113@ic.ac.uk> | 2024-01-04 09:43:06 +0000 |
|---|---|---|
| committer | Paul Lietar <pl2113@ic.ac.uk> | 2024-01-04 10:18:33 +0000 |
| commit | 8e1e16fdcb3ee87ba1308f0ba045c5a2d29c41b5 (patch) | |
| tree | 9ba75ba5b7ad556b60ac0f32f8e5075cfef0ff56 /pkgs/development/python-modules/rangehttpserver | |
| parent | 6ce10ae92e8b3453055c521a17349ee35606b714 (diff) | |
rustc: Fix building cross-compilers for no_std targets.
When building a cross-compiler, the rustc derivation does some tricks to
only build the standard library and reuse the host's compiler, leading
to much faster build time.
Unfortunately, the way the build system was invoked, it would always
build the `std` crate, whether or not the target supports it. Some
bare-metal targets only support building the `core` and `alloc` crates.
By being more vague about the build command, using `library` instead of
`library/std`, Rust's build system is able to figure out exactly which
crates to build:
https://github.com/rust-lang/rust/blob/1.74.1/src/bootstrap/compile.rs#L370-L412
Oddly enough, the install command still needs to use `library/std`, even
if building just a subset:
https://github.com/rust-lang/rust/blob/1.74.1/src/bootstrap/install.rs#L207
The following command was used to reproduce the original issue. Without
this patch, it leads to a build failure when trying to compile one of
std's dependencies. With the patch it completes succesfully and produces
a working cross-compiler.
nix build --impure --expr '(import ./. {
crossSystem = {
config = "riscv32-none-elf";
rustc.config = "riscv32imc-unknown-none-elf";
};
}).buildPackages.rustc'
Diffstat (limited to 'pkgs/development/python-modules/rangehttpserver')
0 files changed, 0 insertions, 0 deletions
