File tree 2 files changed +12
-0
lines changed
cabal-install-solver/src/Distribution/Solver/Modular
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -353,8 +353,13 @@ avoidReinstalls p = go
353
353
pruneHostFromSetup :: EndoTreeTrav d c
354
354
pruneHostFromSetup = go
355
355
where
356
+ -- for Setup(.hs) and build-depends, we want to force Build packages.
356
357
go (PChoiceF qpn rdm gr cs) | (Q (PackagePath _ (QualSetup _)) _) <- qpn =
357
358
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.
358
363
go (PChoiceF qpn rdm gr cs) | (Q (PackagePath _ _) _) <- qpn =
359
364
PChoiceF qpn rdm gr (W. filterKey isHost cs)
360
365
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 =
115
115
traceTree " pruned.json" id .
116
116
trav prunePhase .
117
117
trav P. pruneHostFromSetup .
118
+ -- stageBuildDeps "build: " .
118
119
traceTree " build.json" id $
119
120
buildPhase
120
121
where
@@ -153,9 +154,15 @@ solve sc toolchains idx pkgConfigDB userPrefs userConstraints userGoals =
153
154
154
155
stageBuildDeps prefix = go
155
156
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.
156
159
go (PChoice qpn rdm gr cs) | (Q (PackagePath _ (QualSetup _)) _) <- qpn =
157
160
(PChoice qpn rdm gr (trace (prefix ++ show qpn ++ ' \n ' : unlines (map (" - " ++ ) candidates)) (go <$> cs)))
158
161
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
159
166
go (PChoice qpn rdm gr cs) =
160
167
(PChoice qpn rdm gr (go <$> cs))
161
168
go (FChoice qfn rdm gr t b d cs) =
You can’t perform that action at this time.
0 commit comments