Building GHC using cabal repl

Neil Mitchell ndmitchell at gmail.com
Tue Apr 3 08:24:38 UTC 2018


Hi Joachim,

There are instructions on how to do it, described at
https://github.com/ndmitchell/ghcid/issues/140

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 :)

Thanks, Neil

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[1].
> It included changes to cabal and ghc and the final
> bits have been merged in the form of hadrian#531[2]
> 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[3] for this.
>
> Cheers,
>  Moritz
>
> --
> [1]: https://github.com/snowleopard/hadrian/pull/445
> [2]: https://github.com/snowleopard/hadrian/pull/531
> [3]: https://github.com/snowleopard/hadrian/issues/551
>
>> On Apr 2, 2018, at 11:50 PM, Joachim Breitner <mail at joachim-breitner.de> wrote:
>>
>> Hi,
>>
>> 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,
>>   /home/jojo/build/haskell/ghc/compiler/dist-newstyle/build/x86_64-linux/ghc-8.5.20180320/ghc-8.5/build/autogen,
>>   /home/jojo/build/haskell/ghc/compiler/dist-newstyle/build/x86_64-linux/ghc-8.5.20180320/ghc-8.5/build/global-autogen
>>
>>   cabal: repl failed for ghc-8.5.
>>
>> It seems that the stage2/build directory is not registered as a source
>> directory:
>>
>>   $ find -name Config.hs
>>   ./stage2/build/Config.hs
>>   ./stage1/build/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?)
>>
>> Cheers,
>> Joachim
>>
>> --
>> Joachim “nomeata” Breitner
>>  mail at joachim-breitner.de
>>  https://www.joachim-breitner.de/
>> _______________________________________________
>> ghc-devs mailing list
>> ghc-devs at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


More information about the ghc-devs mailing list