Ticket #2057 (new bug)
inconsistent .hi file error gets ignored
|Reported by:||duncan||Owned by:|
|Type of failure:||Difficulty:||Unknown|
|Test Case:||Blocked By:|
[20 of 20] Compiling Main ( ./Main.hs, dist/build/cabal/cabal-tmp/Main.o ) The interface for `main:Hackage.Config' Declaration for savedConfigToConfigFlags Unfolding of Hackage.Config.savedConfigToConfigFlags: Can't find interface-file declaration for variable Distribution.Simple.Setup.a401 Probable cause: bug in .hi-boot file, or inconsistent .hi file Use -ddump-if-trace to get an idea of which file caused the error Linking dist/build/cabal/cabal ... dist/build/cabal/cabal-tmp/Hackage/Config.o: In function `sfsu_info': (.text+0x70cc): undefined reference to `Cabalzm1zi3zi3_DistributionziSimpleziSetup_a401_closure' dist/build/cabal/cabal-tmp/Hackage/Config.o: In function `rf7U_closure': (.data+0xf28): undefined reference to `Cabalzm1zi3zi3_DistributionziSimpleziSetup_a401_closure' collect2: ld returned 1 exit status
Now, the inconsistent .hi file was entirely my fault. However note that ghc --make did not stop at the error! It continued and tried to link.
This is bad because sometimes linker errors are very long and a user might loose the real source of the error.
The error gets raised in iface/TcIface.lhs by importDecl. The uses of that function look like they are translating the error into failure in other monads ok. It's not immediately obvious at what point in the propagation of this error it gets ignored and linking continues irrespective.
It should not be too hard to reproduce I hope. Generating inconsistent .hi files is fairly easy to do. In this case I just built cabal-install against an existing Cabal. Then rebuilt and re-registered a slightly changed Cabal lib. Then did another build of cabal-install without cleaning first.