From bf13eca852acddd5e44b5ad9b4ebc0629d612737 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 9 Jun 2024 07:10:51 +0100 Subject: [PATCH] rustc: disable wasm32 if some gcc options are set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- pkgs/applications/blockchains/polkadot/default.nix | 3 +++ pkgs/applications/misc/pagefind/default.nix | 3 +++ pkgs/by-name/re/rerun/package.nix | 3 +++ pkgs/by-name/su/surrealist/package.nix | 3 +++ pkgs/by-name/te/tetrio-desktop/tetrio-plus.nix | 3 +++ pkgs/development/compilers/rust/rustc.nix | 4 +++- pkgs/servers/ldap/lldap/default.nix | 3 +++ pkgs/servers/teleport/generic.nix | 5 ++++- 8 files changed, 25 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/blockchains/polkadot/default.nix b/pkgs/applications/blockchains/polkadot/default.nix index 0e71ddb7ba3b..9690ade2947c 100644 --- a/pkgs/applications/blockchains/polkadot/default.nix +++ b/pkgs/applications/blockchains/polkadot/default.nix @@ -92,5 +92,8 @@ rustPlatform.buildRustPackage rec { license = licenses.gpl3Only; maintainers = with maintainers; [ akru andresilva FlorianFranzen RaghavSood ]; platforms = platforms.unix; + # See comment about wasm32-unknown-unknown in rustc.nix. + broken = lib.any (a: lib.hasAttr a stdenv.hostPlatform.gcc) [ "cpu" "float-abi" "fpu" ] || + !stdenv.hostPlatform.gcc.thumb or true; }; } diff --git a/pkgs/applications/misc/pagefind/default.nix b/pkgs/applications/misc/pagefind/default.nix index 2da4e5eb7eb1..f72d999fc896 100644 --- a/pkgs/applications/misc/pagefind/default.nix +++ b/pkgs/applications/misc/pagefind/default.nix @@ -120,6 +120,9 @@ rustPlatform.buildRustPackage rec { license = licenses.mit; maintainers = with maintainers; [ pbsds ]; platforms = platforms.unix; + # See comment about wasm32-unknown-unknown in rustc.nix. + broken = lib.any (a: lib.hasAttr a stdenv.hostPlatform.gcc) [ "cpu" "float-abi" "fpu" ] || + !stdenv.hostPlatform.gcc.thumb or true; mainProgram = "pagefind"; }; } diff --git a/pkgs/by-name/re/rerun/package.nix b/pkgs/by-name/re/rerun/package.nix index 4d9c8da8041c..6fedb10cfed1 100644 --- a/pkgs/by-name/re/rerun/package.nix +++ b/pkgs/by-name/re/rerun/package.nix @@ -126,5 +126,8 @@ rustPlatform.buildRustPackage rec { ]; maintainers = with maintainers; [ SomeoneSerge ]; mainProgram = "rerun"; + # See comment about wasm32-unknown-unknown in rustc.nix. + broken = lib.any (a: lib.hasAttr a stdenv.hostPlatform.gcc) [ "cpu" "float-abi" "fpu" ] || + !stdenv.hostPlatform.gcc.thumb or true; }; } diff --git a/pkgs/by-name/su/surrealist/package.nix b/pkgs/by-name/su/surrealist/package.nix index efd1773dee2f..3463c7ef3b2e 100644 --- a/pkgs/by-name/su/surrealist/package.nix +++ b/pkgs/by-name/su/surrealist/package.nix @@ -192,5 +192,8 @@ in stdenv.mkDerivation (finalAttrs: { mainProgram = "surrealist"; maintainers = with maintainers; [ frankp ]; platforms = platforms.linux; + # See comment about wasm32-unknown-unknown in rustc.nix. + broken = lib.any (a: lib.hasAttr a stdenv.hostPlatform.gcc) [ "cpu" "float-abi" "fpu" ] || + !stdenv.hostPlatform.gcc.thumb or true; }; }) diff --git a/pkgs/by-name/te/tetrio-desktop/tetrio-plus.nix b/pkgs/by-name/te/tetrio-desktop/tetrio-plus.nix index 43102d6c8a26..832123b61c15 100644 --- a/pkgs/by-name/te/tetrio-desktop/tetrio-plus.nix +++ b/pkgs/by-name/te/tetrio-desktop/tetrio-plus.nix @@ -78,6 +78,9 @@ let license = lib.licenses.mit; maintainers = with lib.maintainers; [ huantian wackbyte ]; platforms = lib.platforms.linux; + # See comment about wasm32-unknown-unknown in rustc.nix. + broken = lib.any (a: lib.hasAttr a stdenv.hostPlatform.gcc) [ "cpu" "float-abi" "fpu" ] || + !stdenv.hostPlatform.gcc.thumb or true; }; }; diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index ccaf681307e7..da458211550f 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -103,7 +103,9 @@ in stdenv.mkDerivation (finalAttrs: { stdenv.targetPlatform.rust.rustcTargetSpec # Other targets that don't need any extra dependencies to build. - ] ++ optionals (!fastCross) [ + # Temporarily broken if some global compiler flags are set: + # https://github.com/NixOS/nixpkgs/pull/317273 + ] ++ optionals (!fastCross && !lib.any (a: lib.hasAttr a stdenv.hostPlatform.gcc) [ "cpu" "float-abi" "fpu" ] && stdenv.hostPlatform.gcc.thumb or true) [ "wasm32-unknown-unknown" # (build!=target): When cross-building a compiler we need to add diff --git a/pkgs/servers/ldap/lldap/default.nix b/pkgs/servers/ldap/lldap/default.nix index 5a0444235967..28f05322c77c 100644 --- a/pkgs/servers/ldap/lldap/default.nix +++ b/pkgs/servers/ldap/lldap/default.nix @@ -84,6 +84,9 @@ in rustPlatform.buildRustPackage (commonDerivationAttrs // { changelog = "https://github.com/lldap/lldap/blob/v${lldap.version}/CHANGELOG.md"; license = licenses.gpl3Only; platforms = platforms.linux; + # See comment about wasm32-unknown-unknown in rustc.nix. + broken = lib.any (a: lib.hasAttr a stdenv.hostPlatform.gcc) [ "cpu" "float-abi" "fpu" ] || + !stdenv.hostPlatform.gcc.thumb or true; maintainers = with maintainers; [ bendlas ]; mainProgram = "lldap"; }; diff --git a/pkgs/servers/teleport/generic.nix b/pkgs/servers/teleport/generic.nix index 84b57160d4fa..94ca520964cd 100644 --- a/pkgs/servers/teleport/generic.nix +++ b/pkgs/servers/teleport/generic.nix @@ -180,6 +180,9 @@ buildGoModule rec { platforms = platforms.unix; # go-libfido2 is broken on platforms with less than 64-bit because it defines an array # which occupies more than 31 bits of address space. - broken = stdenv.hostPlatform.parsed.cpu.bits < 64; + broken = stdenv.hostPlatform.parsed.cpu.bits < 64 || + # See comment about wasm32-unknown-unknown in rustc.nix. + lib.any (a: lib.hasAttr a stdenv.hostPlatform.gcc) [ "cpu" "float-abi" "fpu" ] || + !stdenv.hostPlatform.gcc.thumb or true; }; }