libcCross: set to null rather than using assert in nonsense scenarios

As discussed in

  https://discourse.nixos.org/t/help-me-understand-two-load-bearing-assert-statements/51420

The assertion here tickles (via wine, which is always the biggest headache for
our cross-compilation machinery) a `tryEval` that silently drops any outputs
that `throw` while splicing.

In this case, the `gcc.libgcc` output is `throw`ing due to checking if
`libcCross==null`.  The same effect is had by simply setting `libcCross` to
`null` in that situation, and this way we don't have to lean on `tryEval`.
This commit is contained in:
Adam Joseph 2024-09-05 21:53:54 -07:00
parent 0e0665d1e0
commit fa8b6b8e2f

View File

@ -20297,7 +20297,10 @@ with pkgs;
else if name == "relibc" then targetPackages.relibc or relibc
else throw "Unknown libc ${name}";
libcCross = assert stdenv.targetPlatform != stdenv.buildPlatform; libcCrossChooser stdenv.targetPlatform.libc;
libcCross =
if stdenv.targetPlatform == stdenv.buildPlatform
then null
else libcCrossChooser stdenv.targetPlatform.libc;
threadsCross =
lib.optionalAttrs (stdenv.targetPlatform.isMinGW && !(stdenv.targetPlatform.useLLVM or false)) {