[Haskell-cafe] HaXml and ghci unresolved symbol

Andrea Rossato mailing_list at istitutocolli.org
Sun Sep 10 05:26:05 EDT 2006

Il Sat, Sep 09, 2006 at 05:20:55PM -0400, Mark T.B. Carroll ebbe a scrivere:
> FWIW I have the same problem - I can't use HaXml with ghci.
> So it's not just you. (-:


So I found my first bug in ghc... And now I'll dig into ghc bug
reports to see if someone is working on the problem... This is going
to be hard, but it's the way you start learning something....;-)

Thanks for your kind attention. Below the full error messages with the
code producing them.


The code below works fine with Hugs:
Main> :load xml.hs
Main> main


If I try to compile it with ghc I get this:

[11:16:06][andrea at laptop:~/devel/haskell/xml]$ ghc --make xml.hs -package HaXml -package hxml -o prova
Chasing modules from: xml.hs
Compiling Main             ( xml.hs, xml.o )
Linking ...
/usr/local/lib/hxml-0.2/lib/libhxml.a(HaXmlAdapter.o)(.text+0x12c1): In function `spZc_dflt':
: undefined reference to `TextziXMLziHaXmlziPretty_zdwelement_infó
/usr/local/lib/hxml-0.2/lib/libhxml.a(HaXmlAdapter.o)(.text+0x1435): In function `spZy_dflt':
: undefined reference to `TextziXMLziHaXmlziPretty_zdwelement_infó
/usr/local/lib/hxml-0.2/lib/libhxml.a(HaXmlAdapter.o)(.rodata+0xa4): undefined reference to `TextziXMLziHaXmlziPretty_zdwelement_closure`
/usr/local/lib/hxml-0.2/lib/libhxml.a(HaXmlAdapter.o)(.rodata+0xc4): undefined reference to `TextziXMLziHaXmlziPretty_zdwelement_closure`
collect2: ld returned 1 exit status
Loading HaXml and hxml in ghci will produce:
[11:15:39][andrea at laptop:~/devel/haskell/xml]$ ghci -package HaXml -package hxml
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.4.2, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base-1.0 ... linking ... done.
Loading package Cabal-1.1.4 ... linking ... done.
Loading package haskell98-1.0 ... linking ... done.
Loading package haskell-src-1.0 ... linking ... done.
Loading package HaXml-1.13.1 ... linking ... done.
Loading package hxml-0.2 ... linking ... ghc-6.4.2: /usr/local/lib/hxml-0.2/lib/hxml.o: unknown symbol `TextziXMLziHaXmlziTypes_AttValue_con_info`
ghc-6.4.2: unable to load package `hxml-0.2'

This is the code:

module Main where
import Text.XML.HaXml
import HaXmlAdapter -- from hxml

xml = "<a>prova</a>"
doc = xmlParse "tmp" xml

getContent (Document prolog _ (Elem name _ content) _) = content

cont = getContent doc

showDoc :: [Content] -> IO ()
showDoc [] = return ()
showDoc (x:xs) = do putStrLn $ showContent x
                    showDoc xs

main = showDoc cont

More information about the Haskell-Cafe mailing list