Building GHC using cabal repl
ndmitchell at gmail.com
Tue Apr 3 08:24:38 UTC 2018
There are instructions on how to do it, described at
One word of warning - GHC runs preprocessors way more than is
necessary, which vastly slows down the feedback loop. My hope is a GHC
Dev will quickly get frustrated by that and fix it :)
On Tue, Apr 3, 2018 at 2:45 AM, Moritz Angermann <moritz at lichtzwerge.de> wrote:
> Hi Joachim,
> I believe this might be due to the recent changes
> that try to keep the source tree pristine instead
> of generating data in-place. This is partially
> the result of making ghc relocatable: hadrian#445.
> It included changes to cabal and ghc and the final
> bits have been merged in the form of hadrian#531
> just a few days ago into hadrian. The make based
> build system does not take advantage of this.
> As `Config.hs` is a generated file it no resides in
> the build folder; as such I believe your changes to
> be correct.
> Does hadrian have a load all of ghc into ghci? I'm
> afraid I don't think it does yet. I've opened
> hadrian#551 for this.
> : https://github.com/snowleopard/hadrian/pull/445
> : https://github.com/snowleopard/hadrian/pull/531
> : https://github.com/snowleopard/hadrian/issues/551
>> On Apr 2, 2018, at 11:50 PM, Joachim Breitner <mail at joachim-breitner.de> wrote:
>> when hacking on most Haskell projects these days, I enjoy having a
>> shell with
>> ghcid -c 'cabal new-repl -w ghc-8.2'
>> open. I wondered if I can achieve the same when hacking on GHC. The
>> compiler/ directory has a Cabal file.
>> It does not work out-of-the box (in a fully built tree):
>> $ cabal new-repl -w ../inplace/bin/ghc-stage2 -fstage2
>> Build profile: -w ghc-8.5.20180320 -O1
>> In order, the following will be built (use -v for more details):
>> - ghc-8.5 (lib) (first run)
>> Preprocessing library for ghc-8.5..
>> cabal: can't find source for Config in backpack, basicTypes, cmm, codeGen,
>> coreSyn, deSugar, ghci, hsSyn, iface, llvmGen, main, nativeGen, parser,
>> prelude, profiling, rename, simplCore, simplStg, specialise, stgSyn, stranal,
>> typecheck, types, utils, vectorise,
>> cabal: repl failed for ghc-8.5.
>> It seems that the stage2/build directory is not registered as a source
>> $ find -name Config.hs
>> But if I extend the section
>> if flag(stage2)
>> Include-Dirs: stage2
>> with these lines
>> Include-Dirs: stage2/build
>> hs-source-dirs: stage2/build
>> ghc-options: -DSTAGE=2
>> ghc-options: -fobject-code
>> and call cabal like so, it actually works:
>> cabal new-repl -w ../inplace/bin/ghc-stage2 -fstage2
>> If I now make hdevtools use this line, then hacking on GHC will have a
>> bit less friction…
>> (BTW, does Hadrian have a “load all of GHC in GHCi” mode?)
>> Joachim “nomeata” Breitner
>> mail at joachim-breitner.de
>> ghc-devs mailing list
>> ghc-devs at haskell.org
> ghc-devs mailing list
> ghc-devs at haskell.org
More information about the ghc-devs