Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/20287 Uses $topdir/include as the very first place to find DerivedConstants.h Index: compiler/GHC/Unit/State.hs --- compiler/GHC/Unit/State.hs.orig +++ compiler/GHC/Unit/State.hs @@ -613,7 +613,13 @@ initUnits logger dflags cached_dbs = do -- really need to use the platform constants but they have not been loaded. case lookupUnitId unit_state rtsUnitId of Nothing -> return Nothing - Just info -> lookupPlatformConstants (fmap ST.unpack (unitIncludeDirs info)) + Just info -> + let + p :: String + p = topDir dflags ++ "/include" + ps :: [String] + ps = fmap ST.unpack (unitIncludeDirs info) + in lookupPlatformConstants (p : ps) return (dbs,unit_state,home_unit,mconstants)