Building GHC using cabal repl
Joachim Breitner
mail at joachim-breitner.de
Mon Apr 2 15:50:33 UTC 2018
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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180402/f3e96c15/attachment.sig>
More information about the ghc-devs
mailing list