hadrian/build.cabal.sh fails unintuitively when the cabal package index is out of date
If you've never used cabal
before, it requires a cabal update
to fetch the package index. Unfortunately, if you've never used cabal
before, you don't know about this.
Trying to run hadrian/ghci.sh
(which in turn calls hadrian/build.cabal.sh
) without this updated index leads to the perplexing error:
./hadrian/ghci.sh 19:09
++ TERM=dumb
++ CABFLAGS=-v0
++ . hadrian/build.cabal.sh tool-args -q --build-root=.hadrian_ghci --flavour=ghc-in-ghci
+++ CABAL=cabal
+++ CABFLAGS='--disable-documentation --disable-profiling --disable-library-profiling -v0'
+++ PROJ=/home/sandy/prj/ghc/hadrian/cabal.project
+++ '[' -f /home/sandy/prj/ghc/hadrian/cabal.project ']'
+++ type cabal
++++ cabal --numeric-version
+++ CABVERSTR=2.4.1.0
+++ CABVER=(${CABVERSTR//./ })
+++ '[' 2 -gt 2 -o 2 -eq 2 -a 4 -ge 2 ']'
+++ cabal --project-file=/home/sandy/prj/ghc/hadrian/cabal.project new-build --disable-documentation --disable-profiling --disable-library-profiling -v0 -j exe:hadrian
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
+++ cabal --project-file=/home/sandy/prj/ghc/hadrian/cabal.project new-exec --disable-documentation --disable-profiling --disable-library-profiling -v0 hadrian -- --directory /home/sandy/prj/ghc tool-args -q --build-root=.hadrian_ghci --flavour=ghc-in-ghci
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
The solution to this is to explicitly run cabal update
--- perhaps the build script could do this for me? Or at least suggest it :)