hadrian/ghci.sh doesn't work at all with the stack build
Here's a little case study of my harrowing experience with hadrian. Maybe it can help make the experience less painful for others.
I built ghc via hadrian/build.stack.sh. After my stage2 compiler came online, I attempted to run hadrian/ghci.sh, but to no avail.
ghci is not available on my PATH, so the ghci.sh script doesn't work. So I tried changed it to run stack repl -- instead of ghci directly.
However, the ghci.sh script starts a subshell running hadrian/build.cabal.sh, which tries to use whatever cabal is on the PATH. I had an old version installed on my system (v. 2.0.0.1.1), which fails the check in build.cabal.sh, but dumps its error message directly into ghci.sh's flags for ghci.
After upgrading cabal, I tried again. But now stack and cabal interact badly, resulting in an error from build.cabal.sh:
cabal: Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible with
Cabal. Use the flag --package-db to specify a package database (it can be used
multiple times).
When combined with the -e shell setting in build.cabal.sh, this warning kills the build.cabal.sh subshell, and dumps an empty GHC_FLAGS= env var. GHCi subsequently loads, but completely unsuccessfully.
Ok, so I next tried taking ghci from stack (taking the result of stack exec which ghci and putting it on my path.) I reverted my changes to hadrian/ghci.sh, updated it to set the -x flag so I know what's happening, and reran it. This time:
cabal: Could not resolve dependencies:
[__0] trying: hadrian-0.1.0.0 (user goal)
[__1] unknown package: unordered-containers (dependency of hadrian)
[__1] fail (backjumping, conflict set: hadrian, unordered-containers)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: hadrian, unordered-containers
and another empty GHC_FLAGS= var.
This one turned out to be caused by a missing cabal package index. cabal update fixed it, and hadrian/ghci.sh spun up. Except that it hung for 15+ minutes (not sure how long, after that I left it to its own devices.) My assumption was that it was silently building everything again---not finding the stack-built artefacts.
At this point I decided this whole hadrian thing was too much work after futzing with it for 7 hours and ran make instead.