[Haskell-cafe] GHC bug? Cabal bug? Haddock bug?
aslatter at gmail.com
Sat Jan 16 14:41:18 EST 2010
This sounds similar to an issue I was seeing over here:
The module being compiled also includes TH top-level statements, and
was only reproducible when building from Cabal.
Here's another occurance on a different platform:
And the workaround:
Here's the GHC bug report: http://hackage.haskell.org/trac/ghc/ticket/3799
2010/1/16 Mark Lentczner <markl at glyphic.com>:
> === Short Story ===
> If I build syb-with-class-0.6 via cabal (cabal configure; cabal build) in the unpacked tar directory, it builds correctly.
> If I build it via "cabal install" (either from the unpacked directory, or by letting cabal fetch it), then the resulting package is corrupted. In particular, the .hi interface file for Data.Generics.SYB.WithClass.Instances mentions symbols that aren't in the .a file. (Or rather, they have the wrong names.)
> I compared verbose logs of both builds and the differ only in temporary file names.... execpt that the "cabal install" version builds haddock, as my .cabal/conf file has documentation: True. Turns out that if turn documentation off, then then "cabal install" builds a .hi file that matches the .a file... and all is well.
> Is this a bug in cabal? cabal-install? ghc? haddock?
> I have saved logs of all this if anyone wants.
> - Mark (MtnViewMark) Lentczner
> markl at glyphic.com
> === Versions ===
>  : cabal -V
> cabal-install version 0.8.0
> using version 126.96.36.199 of the Cabal library
>  : ghc -V
> The Glorious Glasgow Haskell Compilation System, version 6.10.4
>  : ghc-pkg describe haddock | grep version
> version: 2.4.2
> === Background & Details ===
> I was installing happstack on my Mac with my Haskell Platform (GHC 6.10.4) installation. I have successfully installed dozens of other packages in this environment before, and these results are annomalous.
> I kicked this off via:
> cabal install --user happstack
> This installs many packages, including syb-with-class-0.6, which compiled and installed just fine.
> When installing happstack-data, and compiling the file Happstack/Data/Proxy.hs, during the Template Haskell step (where things get loaded up in ghci), the build encounters this link error:
> [ 7 of 16] Compiling Happstack.Data.Proxy ( src/Happstack/Data/Proxy.hs, dist/build/Happstack/Data/Proxy.o )
> Loading package ghc-prim ... linking ... done.
> Loading package integer ... linking ... done.
> Loading package base ... linking ... done.
> Loading package syb ... linking ... done.
> Loading package array-0.2.0.0 ... linking ... done.
> Loading package bytestring-0.9.1.5 ... linking ... done.
> Loading package containers-0.2.0.1 ... linking ... done.
> Loading package packedstring-0.1.0.1 ... linking ... done.
> Loading package pretty-188.8.131.52 ... linking ... done.
> Loading package template-haskell ... linking ... done.
> Loading package syb-with-class-0.6 ... linking ... done.
> (... many more loads elided...)
> Loading package HaXml-1.13.3 ... linking ... done.
> unknown symbol `_sybzmwithzmclasszm0zi6_DataziGenericsziSYBziWithClassziInstances_dataTypeZMabOQZN_closure'
> That symbol decodes to something referring to:
> package: syb-with-class-0.6
> module: Data.Generics.SYB.WithClass.Instances
> reference: dataType[abOQ]
> The reference turns out to be from Loading Happstack.Data.Default, which in turn imports Data.Generics.SYB.WithClass.Instances.
> Poking around, I found that the interface (.hi) file for Data.Generics.SYB.WithClass.Instances does indeed export such an object:
>  : ghc --show-iface Data/Generics/SYB/WithClass/Instances.hi | fgrep dataType[a
> Data.Generics.SYB.WithClass.Instances.dataType[abOQ]) -}
> Data.Generics.SYB.WithClass.Instances.dataType[abSm]) -}
> dataType[abOQ] :: Data.Generics.SYB.WithClass.Basics.DataType
> dataType[abSm] :: Data.Generics.SYB.WithClass.Basics.DataType
> But, the library doesn't export it:
>  : nm libHSsyb-with-class-0.6.a | fgrep dataTypeZMa
> 0001854c D _sybzmwithzmclasszm0zi6_DataziGenericsziSYBziWithClassziInstances_dataTypeZMaeuiZN_closure
> 00018604 D _sybzmwithzmclasszm0zi6_DataziGenericsziSYBziWithClassziInstances_dataTypeZMaexTZN_closure
> These refer to dataType[aeui] and dataType[aexT], which don't exist in the interface file.
> Something seems amiss here: The interface file is exporting generated names that don't match what the library is exporting.
> If I do the same investigation with the profiling versions of this module, they match:
>  : ghc --show-iface Data/Generics/SYB/WithClass/Instances.p_hi | fgrep dataType[a
> Data.Generics.SYB.WithClass.Instances.dataType[anmx]) -}
> Data.Generics.SYB.WithClass.Instances.dataType[anq8]) -}
> dataType[anmx] :: Data.Generics.SYB.WithClass.Basics.DataType
> dataType[anq8] :: Data.Generics.SYB.WithClass.Basics.DataType
> markl at mtree ~/Library/Haskell/packages/syb-with-class-0.6/lib/ghc-6.10.4
>  : nm libHSsyb-with-class-0.6_p.a | fgrep dataTypeZMa
> 00032704 D _sybzmwithzmclasszm0zi6_DataziGenericsziSYBziWithClassziInstances_dataTypeZManmxZN_closure
> 0003282c D _sybzmwithzmclasszm0zi6_DataziGenericsziSYBziWithClassziInstances_dataTypeZManq8ZN_closure
> These both export something dataType[anmx] and dataType[anq8]
> These two objects, by the way, stem from the last two lines of Data.Generics.SYB.WithClass.Instances.hs:
> $( deriveData [''ByteString] )
> $( deriveData [''L.ByteString] )
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe