
Excerpts from Robin Palotai's message of 2017-01-05 15:42:09 +0100:
Thanks for the pointer Edward, new-build seems nice. It could build base indeed!
Just a note - with the patch, if I had "tests: True" in cabal.project, I got an assertion for pkgStanzasEnabled `Set.isSubsetOf` pkgStanzasAvailable from Distribution/Client/ProjectPlanning.hs. Maybe WAI.
OK, worth reporting as a bug on Cabal tracker if you have time.
Do you think the patch could make it upstream in a form of some flag? --no-require-install=x,y or so.
Yes, I think this would make sense! Edward
Thank you, Robin
2016-12-31 3:28 GMT+01:00 Edward Z. Yang
: On Fri, Dec 30, 2016 at 7:37 PM, Robin Palotai
wrote: Do you know a way to force a rebuild of base with stack? I don't want
to
modify it, just want to feed it through a customized ghc pipeline.
base is part of ghc and must be built along with ghc. It cannot be built separately from ghc, regardless of tooling, if you want it to actually work.
(If you want to see some examples of why it is this way, play around with RebindableSyntax a bit, paying attention to the ways in which it breaks if you do the wrong thing. You can also get some idea of it from the behavior of type roles. In short: ghc must know the precise identity *at machine level*, not just source, of various key types in base. It can only do
Excerpts from Brandon Allbery's message of 2016-12-30 19:45:46 -0500: this
by ghc and base being built together so that various types' machine level representations can be wired into ghc as they are built.)
Although it is true that GHC is closely tied to the particularities of base, you CAN swap out base, as long as the new version of base has all of the wired in entities that GHC expects to see. (This must be the case, because we build stage 1 GHC before we build base.)
To answer OP's question, I don't know how to do it with Stack but I've rebuilt base with cabal-install new-build with a little patch. First you have to modify cabal-install/Distribution/Solver/Modular/Solver.hs, changing the invocation of P.requireInstalled so that "base" isn't on the list; this lets cabal-install decide that it can rebuild base. Then, in your cabal.project, add:
packages: path/to/base constraints: base +integer-gmp
(The integer-gmp flag is manual so you need to make sure you toggle it yourself.) Then cabal new-build will build it, and other packages will make use of it.
Good luck!
Edward