haskell.compiler.*: assert that host->target == build->target tools

CC, CXX, LD, AR, …, LLC, OPT and CLANG will be invoked by GHC's build
system at build time in the build->target role. However, since we are
passing absolute paths, they will get saved in GHC's settings file and
later invoked at runtime, when they should be host->target. This means
that the build->target and host->target tools need to be the same for
our built GHC to work properly which is what we guard using these new
asserts.

Being able to drop these asserts would be a step towards cross-compiling
GHC (as opposed to building a GHC cross-compiler which still works).
This commit is contained in:
sternenseemann 2021-11-30 23:06:44 +01:00
parent 19fc229294
commit c23e14e33f
5 changed files with 45 additions and 5 deletions

View File

@ -1,4 +1,4 @@
{ lib, stdenv, pkgsBuildTarget, targetPackages
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
# build-tools
, bootPkgs
@ -143,6 +143,14 @@ let
];
in
# C compiler, bintools and LLVM are used at build time, but will also leak into
# the resulting GHC's settings file and used at runtime. This means that we are
# currently only able to build GHC if hostPlatform == buildPlatform.
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
stdenv.mkDerivation (rec {
version = "8.10.7";
pname = "${targetPrefix}ghc${variantSuffix}";

View File

@ -1,4 +1,4 @@
{ lib, stdenv, pkgsBuildTarget, targetPackages
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
# build-tools
, bootPkgs
@ -151,6 +151,14 @@ let
];
in
# C compiler, bintools and LLVM are used at build time, but will also leak into
# the resulting GHC's settings file and used at runtime. This means that we are
# currently only able to build GHC if hostPlatform == buildPlatform.
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
stdenv.mkDerivation (rec {
version = "8.8.4";
pname = "${targetPrefix}ghc${variantSuffix}";

View File

@ -1,4 +1,4 @@
{ lib, stdenv, pkgsBuildTarget, targetPackages
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
# build-tools
, bootPkgs
@ -138,6 +138,14 @@ let
];
in
# C compiler, bintools and LLVM are used at build time, but will also leak into
# the resulting GHC's settings file and used at runtime. This means that we are
# currently only able to build GHC if hostPlatform == buildPlatform.
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
stdenv.mkDerivation (rec {
version = "9.0.1";
pname = "${targetPrefix}ghc${variantSuffix}";

View File

@ -1,4 +1,4 @@
{ lib, stdenv, pkgsBuildTarget, targetPackages
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
# build-tools
, bootPkgs
@ -139,6 +139,14 @@ let
];
in
# C compiler, bintools and LLVM are used at build time, but will also leak into
# the resulting GHC's settings file and used at runtime. This means that we are
# currently only able to build GHC if hostPlatform == buildPlatform.
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
stdenv.mkDerivation (rec {
version = "9.2.1";
pname = "${targetPrefix}ghc${variantSuffix}";

View File

@ -1,4 +1,4 @@
{ lib, stdenv, pkgsBuildTarget, targetPackages
{ lib, stdenv, pkgsBuildTarget, pkgsHostTarget, targetPackages
# build-tools
, bootPkgs
@ -152,6 +152,14 @@ let
];
in
# C compiler, bintools and LLVM are used at build time, but will also leak into
# the resulting GHC's settings file and used at runtime. This means that we are
# currently only able to build GHC if hostPlatform == buildPlatform.
assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc;
assert buildTargetLlvmPackages.llvm == llvmPackages.llvm;
assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang;
stdenv.mkDerivation (rec {
inherit version;
inherit (src) rev;