File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
cabal-install-solver/src/Distribution/Solver/Modular Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -353,8 +353,13 @@ avoidReinstalls p = go
353353pruneHostFromSetup :: EndoTreeTrav d c
354354pruneHostFromSetup = go
355355 where
356+ -- for Setup(.hs) and build-depends, we want to force Build packages.
356357 go (PChoiceF qpn rdm gr cs) | (Q (PackagePath _ (QualSetup _)) _) <- qpn =
357358 PChoiceF qpn rdm gr (W. filterKey (not . isHost) cs)
359+ -- QualExe are build-depends. Structure is QualExe (comp) (build-depend).
360+ go (PChoiceF qpn rdm gr cs) | (Q (PackagePath _ (QualExe _ _)) _) <- qpn =
361+ PChoiceF qpn rdm gr (W. filterKey (not . isHost) cs)
362+ -- everything else use Host packages.
358363 go (PChoiceF qpn rdm gr cs) | (Q (PackagePath _ _) _) <- qpn =
359364 PChoiceF qpn rdm gr (W. filterKey isHost cs)
360365 go x = x
Original file line number Diff line number Diff line change @@ -115,6 +115,7 @@ solve sc toolchains idx pkgConfigDB userPrefs userConstraints userGoals =
115115 traceTree " pruned.json" id .
116116 trav prunePhase .
117117 trav P. pruneHostFromSetup .
118+ -- stageBuildDeps "build: " .
118119 traceTree " build.json" id $
119120 buildPhase
120121 where
@@ -153,9 +154,15 @@ solve sc toolchains idx pkgConfigDB userPrefs userConstraints userGoals =
153154
154155 stageBuildDeps prefix = go
155156 where go :: Tree d c -> Tree d c
157+ -- For Setup we must use the build compiler, as the host compiler
158+ -- may not be able to produce code that runs on the build machine.
156159 go (PChoice qpn rdm gr cs) | (Q (PackagePath _ (QualSetup _)) _) <- qpn =
157160 (PChoice qpn rdm gr (trace (prefix ++ show qpn ++ ' \n ' : unlines (map (" - " ++ ) candidates)) (go <$> cs)))
158161 where candidates = map show . filter (\ (I _s _v l) -> l /= InRepo ) . map (\ (_w, (POption i _), _v) -> i) $ W. toList cs
162+ -- Same for build-depends. These show up as QualExe (component) (build-depends).
163+ go (PChoice qpn rdm gr cs) | (Q (PackagePath _ (QualExe _ _)) _) <- qpn =
164+ (PChoice qpn rdm gr (trace (prefix ++ show qpn ++ ' \n ' : unlines (map (" - " ++ ) candidates)) (go <$> cs)))
165+ where candidates = map show . filter (\ (I _s _v l) -> l /= InRepo ) . map (\ (_w, (POption i _), _v) -> i) $ W. toList cs
159166 go (PChoice qpn rdm gr cs) =
160167 (PChoice qpn rdm gr (go <$> cs))
161168 go (FChoice qfn rdm gr t b d cs) =
You can’t perform that action at this time.
0 commit comments