[java-gnome-hackers] --with-gcj-compile almost works now
Brought to you by:
afcowie
From: VEROK I. <vi...@in...> - 2002-12-07 18:14:49
|
After ./configure --with-gcj-compile, the following patch needs to be applied to the generated makefiles. This compiles the native libraries cleanly, and linking them to native binaries is almost possible, too. Error messages are listed after the patch. diff -urN java-gnome.orig/src/Makefile java-gnome/src/Makefile --- java-gnome.orig/src/Makefile 2002-12-07 18:49:02.000000000 +0100 +++ java-gnome/src/Makefile 2002-12-07 18:21:35.000000000 +0100 @@ -119,7 +119,8 @@ sort | sed -e 's/\.c/\.o/g') GNOME_CLASSES:= \ - $(shell ls java/org/gnu/gnome/*.java) + $(shell ls java/org/gnu/gnome/*.java) \ + $(shell ls java/org/gnu/gnome/event/*.java) GNOME_O = ${GNOME_CLASSES:.class=.o} @@ -143,12 +144,12 @@ # native targets native-gtk: $(GTK_O) - $(GCJ) -g -shared $(GTK_O) -o ../lib/libGTKJar.so.${version} + $(GCJ) -fPIC -fjni -g -shared $(GTK_O) -o ../lib/libGTKJar.so.${version} @(cd ../lib; test ! -L libGTKJar.so && ln -s libGTKJar.so.${version} libGTKJar.so) || exit 0 native-gnome: native-gtk $(GNOME_O) - $(GCJ) -g -shared $(GNOME_O) -o ../lib/libGNOMEJar.so.${version} + $(GCJ) -fPIC -fjni -g -shared $(GNOME_O) -Ibuild-java/gtk -Ibuild-java/gnome -o ../lib/libGNOMEJar.so.${version} @(cd ../lib; test ! -L libGNOMEJar.so && ln -s libGNOMEJar.so.${version} libGNOMEJar.so) || exit 0 @@ -180,7 +181,7 @@ @(cd ../lib; test ! -L libGladeJava.so && ln -s libGladeJava.so.${version} libGladeJava.so) || exit 0 native-glade: $(GLADE_O) - $(GCJ) -g -shared $(GLADE_O) -o ../lib/libGladeJar.so.${version} + $(GCJ) -fPIC -fjni -g -shared $(GLADE_O) -Ibuild-java/gtk -I/opt/xalan/xalan.jar -o ../lib/libGladeJar.so.${version} @(cd ../lib; test ! -L libGladeJar.so && ln -s libGladeJar.so.${version} libGladeJar.so) || exit 0 diff -urN java-gnome.orig/test/Makefile java-gnome/test/Makefile --- java-gnome.orig/test/Makefile 2002-12-07 18:49:02.000000000 +0100 +++ java-gnome/test/Makefile 2002-12-07 17:32:33.000000000 +0100 @@ -37,9 +37,11 @@ glade: native-gtk: - + native-gnome: - + +native-glade: + # Targets to clean after us .PHONY: mostlyclean clean distclean maintainer-clean The /opt/xalan/xalan.jar I used above is not a hard requirement, anything will do that has the JAXP interface classes, such as the xmlapis.jar archive distributed with Xerces. Making a completely native binary out of the Glade example Example1 results in just the following linking errors (instead of the thousands that I received before): ../lib/libGTKJar.so: undefined reference to `java::lang::Throwable::getCause()' ../lib/libGTKJar.so: undefined reference to `java::lang::Throwable::initCause(java::lang::Throwable*)' ../lib/libGladeJar.so: undefined reference to `java::lang::reflect::Proxy::newProxyInstance(java::lang::ClassLoader*, JArray<java::lang::Class*>*, java::lang::reflect::InvocationHandler*)' ../lib/libGTKJar.so: undefined reference to `java::lang::Throwable::getStackTrace()' ../lib/libGTKJar.so: undefined reference to `java::lang::Throwable::setStackTrace(JArray<java::lang::StackTraceElement*>*)' ../lib/libGladeJar.so: undefined reference to `javax::xml::parsers::SAXParserFactory::newInstance()' ../lib/libGladeJar.so: undefined reference to `java::lang::reflect::InvocationHandler::class$' collect2: ld returned 1 exit status Since I just grabbed the libgcj-3.3.jar out of Debian's current gcc-snapshot package, with no accompanying native libraries, I suspect that these may also be satisfied by a careful and complete upgrade to gcc-snapshot. I will look into it. The current libgcj-3.3.jar appears to have support for Throwable.initCause(), Throwable.setStackTrace(), and other 1.4 features, so those should not be a problem either. And there was much rejoicing. Istvan |