gcj and JAMA

Andrew Haley aph@redhat.com
Mon Apr 5 10:44:00 GMT 2004


Andreas Balser writes:
 > > You need to tell us a bit more.  What did you do to compile the
 > > JAMA-Matrix jarfile?
 > 
 > I downloaded the source (should I try the jarfile?), and compiled it
 > as listed in the "P.S.":
 > 
 > /tmp $ tar xvzf Jama-1.0.1.tar.gz
 > [...]
 > :/tmp/Jama $ gcj -c *.java
 > :/tmp/Jama/util $ gcj -c Maths.java 
 > :/tmp/Jama $ ar r libMatrix.a `find . -name \*.o`

Version skew.

I think your problem is due to the fact that the .class files and the
.java files in the directory don't correspond to the same version.
You are compiling against the .class files, and linking against the
.java files.  

Delete the .class files, and:

 $ export CLASSPATH=.:/tmp/
 $ find . -name '*.class' | xargs rm
 $ gcj -c *.java -g
 $ (cd util/ && gcj -c Maths.java -g)
 $ ar r libMatrix.a `find . -name \*.o`
 $ gcj TestMatrix.java -o TestMatrix --main=TestMatrix -L /tmp/Jama -lMatrix -g
 $ ./TestMatrix 

Alternatively, compiling the class files and linking against the
.class files would also work.

The new gcj ABI will avoid this problem.

Andrew.



More information about the Java mailing list