How do you build base with your own compiler?

Christopher Done chrisdone at gmail.com
Thu Jun 28 17:51:31 UTC 2018


I did try that first. I did a cabal unpack and ran ./configure, but
sadly it failed with "internal error":

https://gist.github.com/chrisdone/fc784c6dcc2acdfc3d10a55fc4d5378d#file-output-txt-L289

If you have e.g. a docker image that it's known to build inside of,
that would be awesome. I'd much prefer that over the whole compiling
GHC rigmarole.

Ciao!

On Thu, 28 Jun 2018 at 18:35, Herbert Valerio Riedel <hvriedel at gmail.com> wrote:
>
> 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 gmail.com> 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-4.9.1.0 -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
> > -optP-DOPTIMISE_INTEGER_GCD_LCM -optP-include
> > -optPlibraries/base/dist-install/build/autogen/cabal_macros.h
> > -package-id ghc-prim-0.5.0.0 -package-id integer-gmp-1.0.0.1
> > -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:
> >
> > https://gist.github.com/chrisdone/3ca64592aed2053606d8814f2fa5d772
> >
> > 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 haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


More information about the ghc-devs mailing list