[email protected]
[Top] [All Lists]

[Haskell-cafe] GHC bug? Cabal bug? Haddock bug?

Subject: [Haskell-cafe] GHC bug? Cabal bug? Haddock bug?
From: Mark Lentczner
Date: Sat, 16 Jan 2010 11:33:50 -0800
=== 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
    [email protected]
    http://www.ozonehouse.com/mark/
    
=== Versions ===

    [2373] : cabal -V
    cabal-install version 0.8.0
    using version 1.8.0.2 of the Cabal library 
    
    [2374] : ghc -V
    The Glorious Glasgow Haskell Compilation System, version 6.10.4

    [2376] : 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-1.0.1.0 ... 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.
    ghc: 
    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:

    [2324] : 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:

    [2325] : 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:

    [2326] : 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
    
    [email protected]   ~/Library/Haskell/packages/syb-with-class-0.6/lib/ghc-6.10.4
    [2327] : 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
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>