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
@@ -670,7 +670,13 @@ initUnits logger dflags cached_dbs home_units = 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)
 
