@ezyang asked me to file this even though I have only a bug repro-case:
WARNING perform the steps below in a new temporary Git branch if you have anything valuable in your current Git HEAD branch
$ git reset --hard 30f9b86b5ed668e3d8c9636176d66ceac1f6e66a
HEAD is now at 30f9b86 Document downloadIndex more clearly about hackage-security.
$ cabal new-build lib:Cabal
Resolving dependencies...
In order, the following will be built (use -v for more details):
- Cabal-1.25.0.0 (lib) (first run)
Configuring component lib from Cabal-1.25.0.0
Preprocessing library Cabal-1.25.0.0...
[ 1 of 114] Compiling Distribution.Compat.Stack ...
...
[114 of 114] Compiling Distribution.Simple ( Distribution/Simple.hs, /stuff3/work/GitHub/cabal/dist-newstyle/build/x86_64-linux/ghc-8.0.1/Cabal-1.25.0.0/build/Distribution/Simple.o )
Now update to one single commit after, i.e. to d03fe5941b7d10bb423f583c0bdd4b334768e2ba
$ git reset --hard d03fe5941b7d10bb423f583c0bdd4b334768e2ba
HEAD is now at d03fe59 Refactor ComponentEnabledSpec into ComponentRequestedSpec.
$ cabal new-build lib:Cabal
Resolving dependencies...
In order, the following will be built (use -v for more details):
- Cabal-1.25.0.0 (lib) (configuration changed)
Configuring component lib from Cabal-1.25.0.0
Preprocessing library Cabal-1.25.0.0...
[ 48 of 114] Compiling Distribution.Types.Component ( Distribution/Types/Component.hs, /stuff3/work/GitHub/cabal/dist-newstyle/build/x86_64-linux/ghc-8.0.1/Cabal-1.25.0.0/build/Distribution/Types/Component.o )
[ 49 of 114] Compiling Distribution.Types.ComponentRequestedSpec ( Distribution/Types/ComponentRequestedSpec.hs, /stuff3/work/GitHub/cabal/dist-newstyle/build/x86_64-linux/ghc-8.0.1/Cabal-1.25.0.0/build/Distribution/Types/ComponentRequestedSpec.o )
[ 50 of 114] Compiling Distribution.Types.PackageDescription ( Distribution/Types/PackageDescription.hs, /stuff3/work/GitHub/cabal/dist-newstyle/build/x86_64-linux/ghc-8.0.1/Cabal-1.25.0.0/build/Distribution/Types/PackageDescription.o )
[ 51 of 114] Compiling Distribution.Types.GenericPackageDescription ( Distribution/Types/GenericPackageDescription.hs, /stuff3/work/GitHub/cabal/dist-newstyle/build/x86_64-linux/ghc-8.0.1/Cabal-1.25.0.0/build/Distribution/Types/GenericPackageDescription.o ) [Distribution.Types.PackageDescription changed]
[ 52 of 114] Compiling Distribution.PackageDescription ( Distribution/PackageDescription.hs, /stuff3/work/GitHub/cabal/dist-newstyle/build/x86_64-linux/ghc-8.0.1/Cabal-1.25.0.0/build/Distribution/PackageDescription.o ) [Distribution.Types.PackageDescription changed]
[ 53 of 114] Compiling Distribution.Compat.Exception ( Distribution/Compat/Exception.hs, /stuff3/work/GitHub/cabal/dist-newstyle/build/x86_64-linux/ghc-8.0.1/Cabal-1.25.0.0/build/Distribution/Compat/Exception.o )
[ 54 of 114] Compiling Distribution.Compat.Internal.TempFile ( Distribution/Compat/Internal/TempFile.hs, /stuff3/work/GitHub/cabal/dist-newstyle/build/x86_64-linux/ghc-8.0.1/Cabal-1.25.0.0/build/Distribution/Compat/Internal/TempFile.o ) [Distribution.Compat.Exception changed]
[ 55 of 114] Compiling Distribution.Compat.CopyFile ( Distribution/Compat/CopyFile.hs, /stuff3/work/GitHub/cabal/dist-newstyle/build/x86_64-linux/ghc-8.0.1/Cabal-1.25.0.0/build/Distribution/Compat/CopyFile.o ) [Distribution.Compat.Exception changed]
[ 56 of 114] Compiling Distribution.Simple.Utils ( Distribution/Simple/Utils.hs, /stuff3/work/GitHub/cabal/dist-newstyle/build/x86_64-linux/ghc-8.0.1/Cabal-1.25.0.0/build/Distribution/Simple/Utils.o ) [Distribution.Compat.Exception changed]
[ 57 of 114] Compiling Distribution.PackageDescription.Configuration ( Distribution/PackageDescription/Configuration.hs, /stuff3/work/GitHub/cabal/dist-newstyle/build/x86_64-linux/ghc-8.0.1/Cabal-1.25.0.0/build/Distribution/PackageDescription/Configuration.o )
[ 74 of 114] Compiling Distribution.Simple.Program.Builtin ( Distribution/Simple/Program/Builtin.hs, /stuff3/work/GitHub/cabal/dist-newstyle/build/x86_64-linux/ghc-8.0.1/Cabal-1.25.0.0/build/Distribution/Simple/Program/Builtin.o ) [Distribution.Compat.Exception changed]
[ 79 of 114] Compiling Distribution.Make ( Distribution/Make.hs, /stuff3/work/GitHub/cabal/dist-newstyle/build/x86_64-linux/ghc-8.0.1/Cabal-1.25.0.0/build/Distribution/Make.o ) [Distribution.Compat.Exception changed]
Failed to load interface for ‘Distribution.Types.ComponentEnabledSpec’
Use -v to see a list of the files searched for.
Oh yeah, I've also seen this.
Reproduced with HEAD.
This is actually pretty easy to min-repro: build a project, rename a module, rebuild, and you'll get the error.
False alarm: I forgot to rename the module header inside the source file :(
I think this is highly likely to be a GHC bug.
Nailed it. Will post GHC ticket as soon as I write it up.
Here is the upstream bug: https://ghc.haskell.org/trac/ghc/ticket/12723
Is there any reasonable way for Cabal to work around this? I don't think so? Maybe a safety valve to force a fresh rebuild of something?
Most helpful comment
Here is the upstream bug: https://ghc.haskell.org/trac/ghc/ticket/12723