public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* java/1406: Problem with DOM/SAX XML Parsers
@ 2000-12-20 12:26 agis
  0 siblings, 0 replies; only message in thread
From: agis @ 2000-12-20 12:26 UTC (permalink / raw)
  To: java-gnats

>Number:         1406
>Category:       java
>Synopsis:       Problem with DOM/SAX XML Parsers
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    apbianco
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 12:19:39 PST 2000
>Closed-Date:    Thu Nov 30 09:01:08 PST 2000
>Last-Modified:  Thu Nov 30 09:16:00 PST 2000
>Originator:     agis@nortelnetworks.com
>Release:        unknown-1.0
>Organization:
>Environment:
RedHat Linux, HPUX
>Description:
Dear Sir

Due to an ongoing project, some members of my team use the GCJ compiler to produce executable files from JAVA code. There is, however one case where we are getting some unexplainable errors and I thouhg of asking someone expert. So, here is tha situation:

I have the following JAVA file (SAXSpeed.java) , which uses the IBM Java XML Parser to parse an XML file and time this parsing:

===========================================================================================
import java.io.PrintStream;
import org.apache.xerces.framework.XMLParser;
import org.apache.xerces.parsers.SAXParser;

import org.xml.sax.SAXParseException;
import org.xml.sax.SAXException;

import org.xml.sax.*;

public class SAXSpeed
{
    private long elements;
    private long attributes;
    private long characters;


    public static void main(String args[])
    {
        if(args.length == 0)
            System.exit(1);
        for(int i = 0; i < args.length; i++)
        {
            String s = args[i];
            print(s);
        }

    }

    public static void print(String s)
    {
        try
        {
            SAXParser saxparser = new SAXParser();
            long before = System.currentTimeMillis();
            saxparser.parse(s);
            long after = System.currentTimeMillis();
            System.out.print(s);
            System.out.print(": ");
            System.out.print(after - before);
            System.out.print(" ms");
        }
        catch(SAXParseException saxparseexception)
        {
            saxparseexception.printStackTrace(System.err);
        }
        catch(SAXException saxexception)
        {
            if(saxexception.getException() != null)
                saxexception.getException().printStackTrace(System.err);
            else
                saxexception.printStackTrace(System.err);
        }
        catch(Exception exception)
        {
            exception.printStackTrace(System.err);
        }
    }

}
===========================================================================
This file compiles normally with JDK 1.2.2 and also with the -target 1.1 option, which simulates it with the 1.1 version of JAVA. The generated class file is attached in the email. In order to work, the attached zip library (xerces.zip) as well as the path of the class file need to be included in the classpath. 

The class file runs normally when I use java command and it times the xml parsing succesfully.

The problems start when I start using the gcj compiler. I use the following command line (in LINUX OS):

gcj --main=SAXSpeed --classpath=/root/parsers/xml/xerces.zip:/urs/local/gcj/shares/libgcj.zip:. -o SAXSpeed SAXSpeed.class 

or

gcj --main=SAXSpeed --classpath=/root/parsers/xml/xerces.zip:/urs/local/gcj/shares/libgcj.zip:. -o SAXSpeed SAXSpeed.java

No matter how many combinations I tried in the command line, I keep receiving the following error messages:
========================================================================================
/tmp/ccIDEHfu.o: In function `SAXSpeed::print(java::lang::String *)':
/root/parsers/jars/SAXSpeed.class(.text+0xe9): undefined reference to `_CL_Q53org6apache6xerces7parsers9SAXParser'
/root/parsers/jars/SAXSpeed.class(.text+0x11b): undefined reference to `org::apache::xerces::parsers::SAXParser::SAXParser(void)'
/tmp/ccIDEHfu.o: In function `SAXSpeed::SAXSpeed(void)':
/root/parsers/jars/SAXSpeed.class(.gcc_except_table+0x14): undefined reference to `_CL_Q43org3xml3sax17SAXParseException'
/root/parsers/jars/SAXSpeed.class(.gcc_except_table+0x24): undefined reference to `_CL_Q43org3xml3sax12SAXException'
collect2: ld returned 1 exit status
========================================================================================
It doesn't seem to find the class files, although they do exist in the zip file and in the right directory structure. How is that possible?

I know that what I ask is something that will probably take time but I would be greatful if you could help me out with this.

Thank you very much in advance

Agis

    

Agisilaos Kalogiannis
Software Engineer
Wireless & Carrier Netwoks
Nortel Networks
Tel: +44 (0)1279 403407
Mob: +44 (0)772 0844109
agis@nortelnetworks.com
agis_k@hotmail.com
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:

Formerly PR gcj/376


From: Tom Tromey <tromey@cygnus.com>
To: agis@nortelnetworks.com
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: gcj/376: Problem with DOM/SAX XML Parsers
Date: 30 Nov 2000 10:09:08 -0700

 >>>>> "Agis" == agis  <agis@nortelnetworks.com> writes:
 
 Agis> gcj --main=SAXSpeed --classpath=/root/parsers/xml/xerces.zip:/urs/local/gcj/shares/libgcj.zip:. -o SAXSpeed SAXSpeed.java
 
 Agis> /tmp/ccIDEHfu.o: In function `SAXSpeed::print(java::lang::String *)':
 Agis> /root/parsers/jars/SAXSpeed.class(.text+0xe9): undefined reference to `_CL_Q53org6apache6xerces7parsers9SAXParser'
 Agis> /root/parsers/jars/SAXSpeed.class(.text+0x11b): undefined reference to `org::apache::xerces::parsers::SAXParser::SAXParser(void)'
 Agis> /tmp/ccIDEHfu.o: In function `SAXSpeed::SAXSpeed(void)':
 Agis> /root/parsers/jars/SAXSpeed.class(.gcc_except_table+0x14): undefined reference to `_CL_Q43org3xml3sax17SAXParseException'
 Agis> /root/parsers/jars/SAXSpeed.class(.gcc_except_table+0x24): undefined reference to `_CL_Q43org3xml3sax12SAXException'
 Agis> collect2: ld returned 1 exit status
 
 Agis> It doesn't seem to find the class files, although they do exist
 Agis> in the zip file and in the right directory structure. How is
 Agis> that possible?
 
 gcj generates code that assumes that the classes your program refers
 to are also compiled.  However, you aren't telling gcj how to link
 against these programs.  Putting the xerces zip file into CLASSPATH is
 necessary, but not sufficient -- the compiled xerces code isn't in the
 zip file.
 
 I recommend compiling all the xerces classes and building a shared
 library named `libxerces.so' from the resulting objects.  Then add
 `-lxerces' to your gcj command.
 
 I'm going to close this PR since I don't believe it is actually a bug.
 
 Tom
State-Changed-From-To: open->closed
State-Changed-By: tromey
State-Changed-When: Thu Nov 30 09:01:08 2000
State-Changed-Why:
    I don't think this is a bug.

From: tromey@cygnus.com
To: agis@nortelnetworks.com, apbianco@cygnus.com,
  java-gnats@sourceware.cygnus.com
Cc:  
Subject: Re: gcj/376
Date: 30 Nov 2000 17:01:08 -0000

 Synopsis: Problem with DOM/SAX XML Parsers
 
 State-Changed-From-To: open->closed
 State-Changed-By: tromey
 State-Changed-When: Thu Nov 30 09:01:08 2000
 State-Changed-Why:
     I don't think this is a bug.
 
 http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=376&database=java
>Unformatted:



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-12-20 12:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-20 12:26 java/1406: Problem with DOM/SAX XML Parsers agis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).