Closed int-index closed 5 years ago
Thanks @int-index!
Adding @mpickering.
I don't really know how to fix this. What does hadrian do about this? As in order to build hadrian, I was under the impression you needed to build certain libraries bundled with GHC?
hadrian at the very least uses the Cabal
that comes in the GHC source tree, the one that lives at libraries/Cabal/Cabal
. So if you want to build a nix environment with hadrian
compiled and ready to be used to develop GHC, you're always going to already build some of the code from the GHC source tree, and to rebuild hadrian when this code changes and you re-enter the environment/shell.
The problem is that from a fresh clone, you can't build the libraries in the source tree? You have to run ./boot first in order to generate from cabal files?
Yes @mpickering, the problem is that shell.nix
doesn't work on a fresh clone.
An additional problem is that sometimes after doing some work in a nix shell, then exiting it, and entering again, all libraries in the GHC source tree and Hadrian get rebuilt. It's probably nix
not being smart enough and considering build artifacts when computing the hashes — this would be solved if we had srcdir
/ builddir
separation, I suppose.
I don't understand why Hadrian is using libraries shipped with GHC to build itself, can't we use the ones from Hackage/nixpkgs?
Alp seems to imply that only Cabal
is necessary to build from the source tree. Perhaps we could try that? I don't actually use hadrian to do my builds though..
Does Hadrian need Cabal
that is shipped with GHC specifically, or just a fresh enough Cabal that isn't on Hackage at the moment?
Well, it needs a Cabal
that can process all the .cabal
files from the GHC source tree. Using the in-tree one guarantees that we won't have any problem there, but you might want to try using the latest released version and seeing how that goes?
I won't be trying to do this any time soon, as I've got a shell.nix
[1] that works fine for me with the old make
-based build system.
[1] https://gist.github.com/int-index/244f1ea276afa7a611a3aff4edddd202
In general you likely want to build hadrian with ateast the cabal that comes with the ghc you want to build. That is because cabal and ghc are sometimes developed in tandem.
The Make based buildsystem built ghc-cabal against the Cabal that came with ghc die precisely that reason.
Closing in light of #705, created https://ghc.haskell.org/trac/ghc/ticket/15794 instead.
This issue has been migrated to Trac: https://ghc.haskell.org/trac/ghc/ticket/15794
Steps to reproduce:
git clone --recursive git://git.haskell.org/ghc.git
cd ghc/hadrian
git pull https://github.com/snowleopard/hadrian && git checkout master
nix-shell --pure
Expected result: Successful build.
Actual result:
Notice that the build fails for a library shipped with GHC. In
shell.nix
it's included aslocalPackage
.Workaround
First, we need to run
configurePhase
of the default Nix derivation for GHC HEAD:cd ghc
nix-shell '<nixpkgs>' -A haskell.compiler.ghcHEAD
configurePhase
exit
Now we can
cd
intoghc/hadrian
and proceed normally, the build won't fail.The issue is that this step shouldn't be required, we must have a self-contained
shell.nix
.