[Haskell-cafe] GHC Error: "FATAL:Symbol _XJv_srt already defined."

Austin Seipp mad.one at gmail.com
Mon Jul 21 03:04:01 EDT 2008


I can replicate this err with 6.8.3 on my macbook (os 10.5.4.) It also
appears to fail with a copy of the GHC HEAD as well:

$ uname -a
Darwin existential.local 9.4.0 Darwin Kernel Version 9.4.0: Mon Jun  9
19:30:53 PDT 2008; root:xnu-1228.5.20~1/RELEASE_I386 i386
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.8.3
$ ~/ghc-head/bin/ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.9.20080615
$ ghc --make DerivingError.hs
[1 of 1] Compiling DerivingError    ( DerivingError.hs, DerivingError.o )

/var/folders/27/27CWjmd8HK8wG5FT3nu3pk+++TI/-Tmp-//ghc39082_0/ghc39082_0.s:6080:0:
    FATAL:Symbol _XxH_srt already defined.
$ rm DerivingError.hi
$ ~/ghc-head/bin/ghc --make DerivingError.hs
[1 of 1] Compiling DerivingError    ( DerivingError.hs, DerivingError.o )

/var/folders/27/27CWjmd8HK8wG5FT3nu3pk+++TI/-Tmp-/ghc39116_0/ghc39116_0.s:6207:0:
    FATAL:Symbol _XyQ_srt already defined.
$

However, things get even wackier because I *can* get it to build on
the HEAD, only through a very odd compilation step (I figured this out
while trying to examine the ASM output from the -S flag):

$ ~/ghc-head/bin/ghc --version                   
The Glorious Glasgow Haskell Compilation System, version 6.9.20080615
$  ~/ghc-head/bin/ghc --make DerivingError.hs         
[1 of 1] Compiling DerivingError    ( DerivingError.hs, DerivingError.o )

/var/folders/27/27CWjmd8HK8wG5FT3nu3pk+++TI/-Tmp-/ghc44257_0/ghc44257_0.s:6207:0:
    FATAL:Symbol _XyP_srt already defined.
$ rm DerivingError.hi  
$ ~/ghc-head/bin/ghc -S DerivingError.hs 
$ ~/ghc-head/bin/ghc --make DerivingError.hs
[1 of 1] Compiling DerivingError    ( DerivingError.hs, DerivingError.o )
$ 

Although in 6.8.3 it doesn't work regardless; but if we make it build
the object file through this odd step, we can then link it with a main
stub:

$ cat > main.hs                                     
main = putStrLn "hello world"
$ ~/ghc-head/bin/ghc --make main.hs DerivingError.o
[1 of 1] Compiling Main             ( main.hs, main.o )
Linking main ...
$ 

In particular the issue appears to be related to generics (duh,) since
if we search through the .s file generated when using -S, we can see
what it's referring to (6.8.3):

.align 2
_Xxn_srt:  ;; line 5757
        .long   _base_DataziGenericsziBasics_mkDataType_closure
        .long   _s1Zg_closure
        .long   _s1Zi_closure
.const_data
.align 2
_Xw9_srt:
        .long   _Xxn_closure
...

_Xxn_srt: ;; line 6080
        .long   _base_DataziGenericsziBasics_mkDataType_closure
        .long   _s1Zs_closure
        .long   _s1Zu_closure
.data
        .align 2
...

So it seems like a bug in the native code generator for generics.

The ghc-6.9 version was actually a snapshot of the head a few weeks
back as you can see, I'm building the latest HEAD from darcs as we speak,
but in the mean time I would file a bug report with the code attached:

http://hackage.haskell.org/trac/ghc/newticket?type=bug

If you do, I'll be sure to post what I've done here so the devs might
be able to track it easier. If the latest HEAD turns out to work I'll
get back to you as well.

Austin


More information about the Haskell-Cafe mailing list