The PR which fixed `useLLVM` native rustc builds (#320432)
also broke cross builds.
The C compiler it used to produce `llvmShared` and `llvmPackages`,
`llvmPackages.clangUseLLVM`, was built to run on the host
and create binaries for the target (`pkgsHostTarget`).
Instead, the compiler should be built to run on the build
machine and produce binaries for the host machine (`pkgsBuildHost`).
Replace the overridden compilers with ones from `pkgsBuildHost`
Co-Authored-By: Artemis Tosini <me@artem.ist>
Change the bootstrap on all platforms to use a version of the upstream binary
that is equal to the version that is being built, instead of a binary of one
version prior. This is necessary for the 1.82.0 release because on some
platforms (https://github.com/rust-lang/rust/issues/129268) the 1.81.0 binary
can not build the 1.82.0 source. Furthermore, upstream reported that their
development process (now) usually involves building a release compiler with
itself and that "the Rust compiler must be able to build itself".
In preparation for the deprecation of `stdenv.isX`.
These shorthands are not conducive to cross-compilation because they
hide the platforms.
Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way
One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059
There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.
```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
remove the `isRedox` condition which was added because `stdenv.isLinux` uses `hostPlatform`, after specifying `targetPlatform` it's no longer necessary.
Seeing the following new warnings pop up on stderr when cargo was bumped
to 1.78:
```
warning: `/build/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
```
which happens to break commitmsgfmt builds in nix (#320294).
closes#320294
Previously, it wasn't possible to access the list of platforms we can
build Rust programs for outside of buildRustPackage. This was a
problem for packages that have optional Rust components, like
gstreamer or Meson, as there was no way to only build the Rust parts
for supported platforms. Now it's possible to get that information
from rustc's passthru.
to reverse breakage due to it not being supported by
clang when building for wasm32. really we should not be
using a wrapped compiler to build for wasm, but that's
a tangled knot..
Seeing the following new warnings pop up on stderr when cargo was bumped
to 1.78:
```
warning: `/build/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
```
which happens to break commitmsgfmt builds in nix (#320294).
closes#320294
This reverts commits 6d0ba08b97,
723100d83b, and
bf13eca852.
The underlying issue has now been fixed, so we can re-enable
wasm32-unknown-unknown on all platforms.
This is a temporary fix to get rustc building again with these
configurations (which notably include the default aarch64-darwin one)
without causing a stdenv rebuild. The real fix will be to avoid
passing these options through the Clang wrapper when the target is
overridden.
It could be that there are packages that need wasm32-unknown-unknown
beyond those I've marked as broken here — it's impossible to be sure
without a full rebuild. But this should be most of them.