From c445fc25758f9e507949d5fc8176749a0221d333 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Fri, 5 Sep 2025 16:53:54 +0900 Subject: [PATCH] compiler: allow building with boot compiler that doesn't have ghc-internal If the boot compiler doesn't have ghc-internal use "" as the `cGhcInternalUnitId`. This allows booting with older compilers. The subsequent stage2 compilers will have the proper ghc-internal id from their stage1 compiler, that boots them. --- compiler/Setup.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/Setup.hs b/compiler/Setup.hs index c112aaba549d..147cb1e44228 100644 --- a/compiler/Setup.hs +++ b/compiler/Setup.hs @@ -98,8 +98,12 @@ ghcAutogen verbosity lbi@LocalBuildInfo{pkgDescrFile,withPrograms,componentNameM _ -> error "Couldn't find unique cabal library when building ghc" let cGhcInternalUnitId = case lookupPackageName installedPkgs (mkPackageName "ghc-internal") of - -- We assume there is exactly one copy of `ghc-internal` in our dependency closure + -- We assume there is exactly one copy of `ghc-internal` in our dependency closure for + -- ghc >= 9.10 that have the ghc-internal library. [(_,[packageInfo])] -> unUnitId $ installedUnitId packageInfo + -- for ghc < 9.10 we expect to find none. + [] -> "" + -- for anything else this is an issue. _ -> error "Couldn't find unique ghc-internal library when building ghc" -- Write GHC.Settings.Config