Re: [Haskell-cafe] HaXml and ghci unresolved symbol

2006-09-11 Thread Malcolm Wallace
Andrea Rossato [EMAIL PROTECTED] wrote:

 So, I'm not able to create an object file (dynamically) linked to
 HaXml. This is the reason why hxml doesn't work with ghc (and ghci)
 but works perfectly with hugs. 
 
 Now, I don't know whether I should contact the HaXml author or submit
 a bug report to the ghc developers wiki.

I think this must be a bug in ghci, introduced between 6.4.1 and 6.4.2.
I tried your example using HaXml-1.15 and ghc-6.4.1, and could not
reproduce the behaviour.  Everything worked just fine for me, both
interpreted and compiled.

Regards,
Malcolm
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaXml and ghci unresolved symbol

2006-09-11 Thread Udo Stenzel
Andrea Rossato wrote:
 It seems related to dynamic linking: I created a separated module
 (Xml.hs) that imports Text.XML.HaXml and parses a xml string. I then
 created a file (xml.hs) that imports Xml and prints name, defined in
 Xml.hs. The expected output should be elementTest.

Whatever it is, I cannot reproduce any of your problems.  I installed
HaXml-1.13.2 from source using Cabal, and both ghc -c Xml.hs and ghc
--make xml.hs work as expected, even without the -package switch.  This
is GHC 6.4.1 on Linux.

 If I load in ghci the file xml.hs (that imports Xml.hs)

Could it be that you're on Windows, which cannot keep xml.hs and Xml.hs
apart?


-Udo
-- 
Eagles may soar but weasels don't get sucked into jet engines.
-- Steven Wright 


signature.asc
Description: Digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaXml and ghci unresolved symbol

2006-09-11 Thread Andrea Rossato
Il Mon, Sep 11, 2006 at 11:30:41AM +0200, Udo Stenzel ebbe a scrivere:
 Whatever it is, I cannot reproduce any of your problems.  I installed
 HaXml-1.13.2 from source using Cabal, and both ghc -c Xml.hs and ghc
 --make xml.hs work as expected, even without the -package switch.  This
 is GHC 6.4.1 on Linux.

I installed HaXml-1.13.2 from source using Cabal

... Instead I did not!! I followed the instruction on the HaXml web
site: ./configure; make; make install...

I'm using Linux too. So, first I installed a fresh ghc-6.4.1 and got
the same problem. Than I tried installing HaXml using just Cabal:
runhaskell Setup.hs configure|build|install and... HaXml started
working fine!

I went back to ghc-6.4.2 and did the same, with Cabal. And it works
perfectly!

I don't know what to say... Well, I do know, in fact: first, thank you
all, thank you so much for you kind patience and the time you spent to
help me. Second, never trust developers' instruction on how to install
their software...;-)

Thank you once again!

Andrea

ps: needless to say, even hxml works perfectly now!


pgpmNRmgU9wne.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaXml and ghci unresolved symbol

2006-09-10 Thread Andrea Rossato
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. (-:


Indeed! 

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.

Andrea


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

Main 

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

[11:16:[EMAIL PROTECTED]:~/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:[EMAIL PROTECTED]:~/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 = aprova/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
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaXml and ghci unresolved symbol

2006-09-10 Thread Andrea Rossato
Il Sat, Sep 09, 2006 at 04:34:04AM +0100, Marco André F. de Almeida ebbe a 
scrivere:
 I know this will not solve your problem, but just so that you
 know that with Hugs, you code works without any problems.
 If you don't want/need to compile the program, I guess one interpreter
 (Hugs) is as good as the other (GHCi) ;-)
 
 Marco

Hi Marco!

For the time being, that is to say, for learning xml transformation in
haskell Hugs is just fine.

But I'd like to start working on a project of a command line tool with
hscurses that requires xml processing.

I'm going to do that mostly as a learning exercise and I'm still in
the preliminary phase, looking for libraries and tools.

I'd like to start writing real code for the xml part, though.

Thanks,
Andrea



pgpDF5a7eJoav.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaXml and ghci unresolved symbol

2006-09-10 Thread Lemmih

It looks a bit like 'HaXml' has been updated after 'hxml' was built.
Try rebuilding 'hxml' against the 'HaXml' you've got installed.

On 9/10/06, Andrea Rossato [EMAIL PROTECTED] wrote:

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. (-:


Indeed!

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.

Andrea


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

Main

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

[11:16:[EMAIL PROTECTED]:~/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:[EMAIL PROTECTED]:~/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 = aprova/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
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe




--
Cheers,
 Lemmih
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaXml and ghci unresolved symbol

2006-09-10 Thread Andrea Rossato
Il Sun, Sep 10, 2006 at 11:41:45AM +0200, Lemmih ebbe a scrivere:
 It looks a bit like 'HaXml' has been updated after 'hxml' was built.
 Try rebuilding 'hxml' against the 'HaXml' you've got installed.

No, I installed the together, HaXml first and then hxml

In hxml there where a couple of bugs, and no cabal file - AFAIK hxml is not
maintained anymore - last release was done in 2002.
I put everything in order and compiled it. Works fine in Hugs.
Who knows, it could be just me.

But! Look at this code, only pure HaXml. 
The output should be a and works with Hugs:

module Main where
import Text.XML.HaXml

xml = aprova/a
doc = xmlParse tmp xml
elemName (Document prolog _ (Elem name _ content) _) = name
name = elemName doc

main = putStrLn name

And now:

[12:03:[EMAIL PROTECTED]:~/devel/haskell/xml]$ ghc --make xml1.hs -package 
HaXml -o prova
Chasing modules from: xml1.hs
Compiling Main ( xml1.hs, xml1.o )
Linking ...
[12:03:[EMAIL PROTECTED]:~/devel/haskell/xml]$ ./prova 
a
[12:03:[EMAIL PROTECTED]:~/devel/haskell/xml]$ ghci -package HaXml xml1.hs
[logo]
Loading package base-1.0 ... linking ... done.
Loading package haskell98-1.0 ... linking ... done.
Loading package HaXml-1.13.1 ... linking ... done.
Skipping  Main ( xml1.hs, xml1.o )
Ok, modules loaded: Main.
Prelude Main main
interactive: xml1.o: unknown symbol `TextziXMLziHaXmlziParse_xmlParse_closure'

Prelude Main :quit
Leaving GHCi.


This is just amazing for a Haskell newbie!

Ciao
Andrea
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaXml and ghci unresolved symbol

2006-09-10 Thread Udo Stenzel
Andrea Rossato wrote:
 [12:03:[EMAIL PROTECTED]:~/devel/haskell/xml]$ ghci -package HaXml xml1.hs
 [logo]
 Loading package base-1.0 ... linking ... done.
 Loading package haskell98-1.0 ... linking ... done.
 Loading package HaXml-1.13.1 ... linking ... done.
 Skipping  Main ( xml1.hs, xml1.o )
 Ok, modules loaded: Main.
 Prelude Main main
 interactive: xml1.o: unknown symbol 
 `TextziXMLziHaXmlziParse_xmlParse_closure'

Hrm, you're accessing a symbol presumably found in a library that isn't
loaded.  Either GHC cannot find the library, which shouldn't happen if
you're using the right package switch, or the .hi file you compiled
against is out of synch with the library, which also shouldn't happen,
as both were compiled from the same source.

- Did you compile and install HaXml from source?  If not, was the binary
  meant for the version of GHC you're using?
- Did you update anything after doing so?  Some library, GHC itself, ...?
- Did you use weird compiler switches (profiling on/off with missing
  profiling libraries)?
- Did you move things around after compiling?  Broken package database?
  configure --user with install --global or vice versa?
- Did you install more than one version of HaXml?  Or are remnants of
  failed installation attempts still in the search path?

You could try the brute force approach of just exploding the source tree
of HaXml right into your project directory and not using the installed
package at all.  ghc --make should be able to pick up the sources and
compile them without further ado.  For hxml this might actually be the
right thing to do, because it's so small.  However, if you didn't mess
with the internals of some package, your problem is just weird.


Udo.
-- 
in the middle of a discussion about the evil mangler in GHC 5.04:
shapr the evil mangler uses *perl* ??
ChilliX yes...
ChilliX it is Evil after all


signature.asc
Description: Digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaXml and ghci unresolved symbol

2006-09-10 Thread Andrea Rossato
Il Sun, Sep 10, 2006 at 01:56:25PM +0200, Udo Stenzel ebbe a scrivere:
 Hrm, you're accessing a symbol presumably found in a library that isn't
 loaded.  Either GHC cannot find the library, which shouldn't happen if
 you're using the right package switch, or the .hi file you compiled
 against is out of synch with the library, which also shouldn't happen,
 as both were compiled from the same source.
 
 - Did you compile and install HaXml from source?  If not, was the binary
   meant for the version of GHC you're using?

I installed from source, compiling by myself.

 - Did you update anything after doing so?  Some library, GHC itself, ...?

No. Installed HaXml and tried it with this results.

 - Did you use weird compiler switches (profiling on/off with missing
   profiling libraries)?

No. Just the HaXml default ones. Nothing weird as far as I can see.

 - Did you move things around after compiling?  Broken package database?
   configure --user with install --global or vice versa?

No. Also because that would result in ghc not compiling the code, I
think. Instead, the code *gets* compiled by ghc, *but not* loaded by
ghci: same code, obviously.

 - Did you install more than one version of HaXml?  Or are remnants of
   failed installation attempts still in the search path?

No, just version 1.13.1. No failed attempts whatsoever.
 
 You could try the brute force approach of just exploding the source tree
 of HaXml right into your project directory and not using the installed
 package at all.  ghc --make should be able to pick up the sources and
 compile them without further ado.  For hxml this might actually be the
 right thing to do, because it's so small.  However, if you didn't mess
 with the internals of some package, your problem is just weird.

I did not mess with anything. I believe my problem is weird, indeed.
The solution you describe is feasible, but I'd like to get the general
problem solved...;-)

Andrea


pgpb0bNuRmKlc.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaXml and ghci unresolved symbol

2006-09-10 Thread Andrea Rossato
Il Sat, Sep 09, 2006 at 02:17:36PM +0200, Andrea Rossato ebbe a scrivere:
 probably it's me, but I cannot understand what I'm doing wrong.

Thanks to the discussion of this thread I was able to (sort of)
isolate the problem and understand why I cannot get hxml (if linked
with HaXml) to work with ghci.

It seems related to dynamic linking: I created a separated module
(Xml.hs) that imports Text.XML.HaXml and parses a xml string. I then
created a file (xml.hs) that imports Xml and prints name, defined in
Xml.hs. The expected output should be elementTest.

Now: if I compile Xml.hs alone it compiles without warnings or errors.
But when I try to load Xml.o with ghci I get an unresolved symbol
error.

If I load in ghci the file xml.hs (that imports Xml.hs), it loads
fine, but when I try to evaluate main I get the same unresolved
symbol error.

If I compile xml.hs, statically linking it to Xml.hs, I get a
perfectly working a.out that runs as expected.

So, I'm not able to create an object file (dynamically) linked to
HaXml. This is the reason why hxml doesn't work with ghc (and ghci)
but works perfectly with hugs. 

hxml works fine if I do not link it to HaXml (that is to say, without
using the HaXmlAdapter module).

Now, I don't know whether I should contact the HaXml author or submit
a bug report to the ghc developers wiki.

Can you please help me with this point? And, if you happen to have a
second and HaXml installed, can you reproduce my problem?

Thank you very much for your kind attention.

Below the code with the output of my attempts.
Sorry for such a long message.

Ciao
Andrea

 

Xml.hs:
---
module Xml where
import Text.XML.HaXml

xml = elementTestThis is a test/elementTest
doc = xmlParse tmp xml

elemName (Document prolog _ (Elem name _ content) _) = name
name = elemName doc


xml.hs:
---
module Main where
import Xml

main = putStrLn name
-

Results:


$ ghc --make -package HaXml Xml.hs 
Chasing modules from: Xml.hs
Compiling Xml  ( Xml.hs, Xml.o )

$ ghci -package HaXml Xml.o 
[logo]
Loading package base-1.0 ... linking ... done.
Loading package haskell98-1.0 ... linking ... done.
Loading package HaXml-1.13.1 ... linking ... done.
Loading object (static) Xml.o ... done
final link ... ghc-6.4.2: Xml.o: unknown symbol 
`TextziXMLziHaXmlziParse_xmlParse_closure'
ghc-6.4.2: linking extra libraries/objects failed

$ ghci -package HaXml xml.hs 
[logo]
Loading package base-1.0 ... linking ... done.
Loading package haskell98-1.0 ... linking ... done.
Loading package HaXml-1.13.1 ... linking ... done.
Skipping  Xml  ( ./Xml.hs, ./Xml.o )
Compiling Main ( xml.hs, interpreted )
Ok, modules loaded: Main, Xml.
*Main main
interactive: ./Xml.o: unknown symbol 
`TextziXMLziHaXmlziParse_xmlParse_closure'

*Main :quit
Leaving GHCi.


$ ghc --make -package HaXml xml.hs 
Chasing modules from: xml.hs
Skipping  Xml  ( ./Xml.hs, ./Xml.o )
Compiling Main ( xml.hs, xml.o )
Linking ...
$ ./a.out 
elementTest

$ ghci -package HaXml /usr/lib/ghc-6.4.2/HSHaXml.o
[logo]
Loading package base-1.0 ... linking ... done.
Loading package haskell98-1.0 ... linking ... done.
Loading package HaXml-1.13.1 ... linking ... done.
Loading object (static) /usr/lib/ghc-6.4.2/HSHaXml.o ... done
final link ... done
Prelude :quit
Leaving GHCi.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaXml and ghci unresolved symbol

2006-09-09 Thread Jason Dagit

On 9/9/06, Andrea Rossato [EMAIL PROTECTED] wrote:

Hello!

[snip]

During interactive linking, GHCi couldn't find the following symbol:
  TextziXMLziHaXmlziParse_xmlParse_closure
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session.  Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please send a bug report to:
  glasgow-haskell-bugs@haskell.org
*Xml


Maybe ...use -package HaXml interactively with GHCi... (That's from
the HaXml website.)

So try it with ghci -package HaXml Xml.hs?

HTH,
Jason
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HaXml and ghci unresolved symbol

2006-09-09 Thread Andrea Rossato
Il Sat, Sep 09, 2006 at 09:58:03AM -0700, Jason Dagit ebbe a scrivere:
 Maybe ...use -package HaXml interactively with GHCi... (That's from
 the HaXml website.)

I'm using -package HaXml, obviously, otherwise the module would not
load.

What I do not understand is that unresolved symbol message: I would
expect some type error message, or some other kind of error...

The HaXml library has been correctly installed, as far as I know: I
can compile and run some examples.

I'm facing a similar problem when linking hxml to HaXml: I'd like to
use the HaXmlAdapter module of hxml, but I keep getting a similar
unresolved symbol message. 

Message that I'm not able to understand: when it comes to c or c++
code I know I can run ldd, or I can chase a missing library. I don't
know what to do with ghc. :-(

Thanks for your kind attention.
Andrea


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe