rustc: disable wasm32 if some gcc options are set

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.
This commit is contained in:
Alyssa Ross 2024-06-09 07:10:51 +01:00
parent ddc356c1f0
commit bf13eca852
No known key found for this signature in database
GPG Key ID: F9DBED4859B271C0
8 changed files with 25 additions and 2 deletions

View File

@ -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;
};
}

View File

@ -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";
};
}

View File

@ -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;
};
}

View File

@ -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;
};
})

View File

@ -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;
};
};

View File

@ -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

View File

@ -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";
};

View File

@ -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;
};
}