How to use locally compiled GHC?

Stefan Klinger <[email protected]> Tue, 2 Dec 2025 20:28:03 +0100
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <aS89w4yPNnoNrOXJ@tauhou>
Hello,

what do I have to do to use a locally compiled GHC on my own projects?

Background: I'm working on this [1].

I've managed to compile GHC following the instructions given on
https://ghc.dev, also here [2].  I can run

    $ ./_build/stage1/bin/ghc --interactive
    GHCi, version 9.15.20251202: https://www.haskell.org/ghc/  :? for help

with the expected result.

However, the locally built compiler (master branch, without any
modifications) fails with all but the most primitive of my own
projects.  I try to do this by adding a line

    with-compiler: /home/sk/prg/ghc/master/_build/stage1/bin/ghc

to the `cabal.project` file of a project.  Then, success depends on
the dependencies of a project.  Here is one using `criterion`:

    $ cabal build
    Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.12.1.0 supports
    'ghc' version < 9.12): /home/sk/prg/ghc/third/_build/stage1/bin/ghc is version
    9.15.20251202
    Resolving dependencies...
    Error: [Cabal-7107]
    Could not resolve dependencies:
    [__0] next goal: foo (user goal)
    [__0] rejecting: foo-1.0 (constraint from user target requires ==0.0.1)
    [__0] trying: foo-0.0.1
    [__1] trying: criterion-1.6.4.1 (dependency of foo)
    [__2] trying: vector-algorithms-0.9.1.0 (dependency of criterion)
    [__3] trying: primitive-0.9.1.0 (dependency of vector-algorithms)
    [__4] next goal: base (dependency of foo)
    [__4] rejecting: base-4.22.0.0/installed-inplace (conflict: primitive => base>=4.10 && <4.22)
    [__4] rejecting: base; 4.21.0.0, 4.20.2.0, 4.20.1.0, 4.20.0.1, 4.20.0.0, 4.19.2.0, 4.19.1.0, 4.19.0.0, 4.18.3.0, 4.18.2.1, 4.18.2.0, 4.18.1.0, 4.18.0.0, 4.17.2.1, 4.17.2.0, 4.17.1.0, 4.17.0.0, 4.16.4.0, 4.16.3.0, 4.16.2.0, 4.16.1.0, 4.16.0.0, 4.15.1.0, 4.15.0.0, 4.14.3.0, 4.14.2.0, 4.14.1.0, 4.14.0.0, 4.13.0.0, 4.12.0.0, 4.11.1.0, 4.11.0.0, 4.10.1.0, 4.10.0.0, 4.9.1.0, 4.9.0.0, 4.8.2.0, 4.8.1.0, 4.8.0.0, 4.7.0.2, 4.7.0.1, 4.7.0.0, 4.6.0.1, 4.6.0.0, 4.5.1.0, 4.5.0.0, 4.4.1.0, 4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1, 4.2.0.0, 4.1.0.0, 4.0.0.0, 3.0.3.2, 3.0.3.1 (constraint from non-reinstallable package requires installed instance)
    [__4] fail (backjumping, conflict set: base, foo, primitive)
    After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: base, primitive, vector-algorithms, criterion, uvector, foo
    Try running with --minimize-conflict-set to improve the error message.

And similar problems occur when depending on `unliftio` or
`attoparsec`.

How should I approach this?

And I expect to run into similar questions in the near future, i.e.,
related to bulding, testing, using, but not necessarily related to
[1].  Where should I ask?

Kind regards
Stefan


[1]: https://github.com/haskell/core-libraries-committee/issues/367
[2]: https://gitlab.haskell.org/ghc/ghc/-/wikis/contributing



-- 
Stefan Klinger, Ph.D. -- computer scientist              o/X
http://stefan-klinger.de                                 /\/
https://github.com/s5k6                                    \
I prefer receiving plain text messages, not exceeding 32kB.
_______________________________________________
Haskell-Cafe mailing list -- [email protected]
To (un)subscribe, modify options or view archives go to:
Only members subscribed via the mailman list are allowed to post.