How do you build base with your own compiler?

Herbert Valerio Riedel hvriedel at
Thu Jun 28 17:35:46 UTC 2018

Note that `base` is mostly a normal cabal package and you can easily
build it with `cabal new-build` if that's any help.
On Thu, Jun 28, 2018 at 7:09 PM Christopher Done <chrisdone at> wrote:
> I've built the GHC compiler along with libraries/base in the canonical way.
> Now, I want to compile base with my own compiler frontend which will
> do some analysis. Here's what I've done so far:
> 1) I've compiled my frontend with the ghc-stage2 compiler and
> registered it. That works.
> 2) I've found the right GHC invocation which looks like this:
> "inplace/bin/ghc-stage1" -hisuf hi -osuf  o -hcsuf hc -static  -O0
> -H64m -Wall      -this-unit-id base- -hide-all-packages -i
> -ilibraries/base/. -ilibraries/base/dist-install/build
> -ilibraries/base/dist-install/build/autogen
> -Ilibraries/base/dist-install/build
> -Ilibraries/base/dist-install/build/autogen -Ilibraries/base/include
> -optPlibraries/base/dist-install/build/autogen/cabal_macros.h
> -package-id ghc-prim- -package-id integer-gmp-
> -package-id rts -this-unit-id base -XHaskell2010 -O0
> -no-user-package-db -rtsopts -Wno-trustworthy-safe
> -Wno-deprecated-flags     -Wnoncanonical-monad-instances  -odir
> libraries/base/dist-install/build -hidir
> libraries/base/dist-install/build -stubdir
> libraries/base/dist-install/build   -dynamic-too $hsfile
> So I
> (1) changed stage1 to stage2, so that I could use plugins,
> (2) simply added --frontend GhcFrontendPlugin -package frontend and
> ran that on every file under base/ in a loop:
> That seems to work. I basically have what I wanted.
> But I'd rather be able to invoke make with e.g.
> GHC_COMPILER=inplace/ghc/stage2 and EXTRA_HC_OPTS=" --frontend
> GhcFrontendPlugin -package frontend". Is there an easy flag to do
> that?
> If not, can someone point me where in the makefile I could tweak this?
> Cheers
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at

More information about the ghc-devs mailing list