Hi there,
I'm trying to compile some stuff using gcj, and have run into an as yet unsolved problem involving java.io.InputStreamReader. Here's what I'm doing, and the output I'm getting:
$ gcj -Ixml-apis.jar -IxercesImpl-2.2.1.jar -classpath <lots of jars, none of which contains java.io.InputStreamReader--I checked> -c -o xbean.o xbean.jar
org/apache/xmlbeans/impl/common/SniffedXmlInputStream.java: In class 'org.apache.xmlbeans.impl.common.SniffedXmlInputStream':
org/apache/xmlbeans/impl/common/SniffedXmlInputStream.java: In method 'org.apache.xmlbeans.impl.common.SniffedXmlInputStream.sniffForXmlDecl(java.lang.String)':
org/apache/xmlbeans/impl/common/SniffedXmlInputStream.java:160: error: class 'java.io.InputStreamReader' has no method named '<init>' matching signature '(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V'
org/apache/xmlbeans/impl/common/SniffedXmlInputStream.java:160: error: expected type 'null' but stack contains 'java.io.InputStreamReader'
org/apache/xmlbeans/impl/common/SniffedXmlInputStream.java:160: confused by earlier errors, bailing out
make: *** [xbean.o] Error 1
Now, the only relevant copy of java.io.InputStreamReader should be the one in /usr/share/java/libgcj-4.0.0.jar and it looks like this:
$ javap -classpath /usr/share/java/libgcj-4.0.0.jar java.io.InputStreamReader
Compiled from "InputStreamReader.java"
public class java.io.InputStreamReader extends java.io.Reader{
public java.io.InputStreamReader(java.io.InputStream);
public java.io.InputStreamReader(java.io.InputStream, java.lang.String) throws java.io.UnsupportedEncodingException;
public java.io.InputStreamReader(java.io.InputStream, java.nio.charset.Charset);
public java.io.InputStreamReader(java.io.InputStream, java.nio.charset.CharsetDecoder);
public java.lang.String getEncoding();
public int read() throws java.io.IOException;
public int read(char[], int, int) throws java.io.IOException;
public boolean ready() throws java.io.IOException;
public void close() throws java.io.IOException;
}
Clearly the constructor gcj is looking for is present in the corresponding .class file in that jar, and it's not a native method (I've decompiled it to have a look). But, curiously, the /usr/include/c++/4.0.0/java/io/InputStreamReader.h that comes with libgcj-devel is a very old version that doesn't mention java.nio at all.
I don't have any JAVA_HOME or CLASSPATH set, or any pre-1.4 JVMs on my machine that would contain the older version of java.io.InputStreamReader. I've tried moving that .h file aside to see if gcj is using it at runtime and it didn't make any difference, so I don't think the .h file is having a direct effect. But it does look like evidence of some kind of version filtration having happened somewhere in the build process.
Does anyone have any hints as to why this might be happening, or how I might get past it?
Thanks!
-0xe1a