Re: gcj 4.4 and AWT toolkit
Mark Wielaard <[email protected]>
| Newsgroups | gmane.comp.gcc.java.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Francesco, On Wed, 2008-08-13 at 17:41 +0200, ffileppo wrote: > What's the difference between using "../gcc/configure" and "../configure" ? Just depends on where you have your gcc-obj build dir. I have it next to my gcc source dir. You probably have it inside your gcc source dir. I am now seeing your failure also. Don't know why I wasn't seeing it earlier. But I must have tried the wrong thing since I now see why it cannot have worked. The latest GNU Classpath import added this patch: 2008-02-08 Roman Kennke <[email protected]> * gnu/java/awt/peer/gtk/CairoGraphics2D.java, * gnu/java/awt/peer/gtk/GdkFontPeer.java, * gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java, * gnu/java/awt/peer/gtk/GdkPixbufDecoder.java, * gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java, * gnu/java/awt/peer/gtk/GtkComponentPeer.java, * gnu/java/awt/peer/gtk/GtkToolkit.java: Only call System.loadLibrary() when configured so. As Roman explained: This changes the System.loadLibrary() calls in the GTK peers, so that they are only called when configured so. This is important for VMs that can't or don't want to link dynamically, e.g. when creating full static linked binaries like Jamaica. And indeed libgcj has a gnu/classpath/Configuration.java which defines INIT_LOAD_LIBRARY = false. And so gtkpeer.so is never loaded. Causing the native jni function call to not resolve giving the java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.gtk.GtkToolkit [...] Caused by: java.lang.UnsatisfiedLinkError: initIDs libgcj does this because it has its own native cni implementation and doesn't use the classpath jni libraries. Except for... the gtk+ one. Have to think about the cleanest way to solve this. But reverting this part of the import (attached) should get you going for now. You'll need to configure with --enable-java-maintainer-mode (see the libjava/HACKING file for more explanation). Cheers, Mark
gtk-loadlibrary-revert.patch
(text/x-patch, 4 KB)
Index: classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java
===================================================================
--- classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java (revision 138388)
+++ classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java (working copy)
@@ -38,8 +38,6 @@
package gnu.java.awt.peer.gtk;
-import gnu.classpath.Configuration;
-
import gnu.java.awt.ClasspathToolkit;
import java.awt.AWTPermission;
@@ -122,10 +120,7 @@
{
static
{
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary("gtkpeer");
- }
+ System.loadLibrary("gtkpeer");
}
/**
Index: classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java
===================================================================
--- classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java (revision 138388)
+++ classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java (working copy)
@@ -38,7 +38,6 @@
package gnu.java.awt.peer.gtk;
-import gnu.classpath.Configuration;
import gnu.classpath.Pointer;
import gnu.java.awt.ClasspathToolkit;
@@ -167,10 +166,7 @@
static
{
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary("gtkpeer");
- }
+ System.loadLibrary("gtkpeer");
initStaticState ();
Index: classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
===================================================================
--- classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java (revision 138388)
+++ classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java (working copy)
@@ -68,17 +68,13 @@
import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageOutputStream;
-import gnu.classpath.Configuration;
import gnu.classpath.Pointer;
public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
{
static
{
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary("gtkpeer");
- }
+ System.loadLibrary("gtkpeer");
initStaticState ();
}
Index: classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
===================================================================
--- classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java (revision 138388)
+++ classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java (working copy)
@@ -38,7 +38,6 @@
package gnu.java.awt.peer.gtk;
-import gnu.classpath.Configuration;
import gnu.java.awt.ClasspathGraphicsEnvironment;
import java.awt.Font;
@@ -73,10 +72,7 @@
static
{
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary("gtkpeer");
- }
+ System.loadLibrary("gtkpeer");
GtkToolkit.initializeGlobalIDs();
initIDs();
Index: classpath/gnu/java/awt/peer/gtk/GtkToolkit.java
===================================================================
--- classpath/gnu/java/awt/peer/gtk/GtkToolkit.java (revision 138388)
+++ classpath/gnu/java/awt/peer/gtk/GtkToolkit.java (working copy)
@@ -39,8 +39,6 @@
package gnu.java.awt.peer.gtk;
-import gnu.classpath.Configuration;
-
import gnu.java.awt.AWTUtilities;
import gnu.java.awt.EmbeddedWindow;
import gnu.java.awt.dnd.GtkMouseDragGestureRecognizer;
@@ -172,10 +170,7 @@
static
{
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary("gtkpeer");
- }
+ System.loadLibrary("gtkpeer");
/**
* Gotta do that first.
Index: classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
===================================================================
--- classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java (revision 138388)
+++ classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java (working copy)
@@ -46,7 +46,6 @@
import java.awt.Window;
import java.util.ArrayList;
-import gnu.classpath.Configuration;
import gnu.classpath.Pointer;
class GdkScreenGraphicsDevice extends GraphicsDevice
@@ -99,11 +98,7 @@
static
{
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary("gtkpeer");
- }
-
+ System.loadLibrary("gtkpeer");
GtkToolkit.initializeGlobalIDs();
initIDs();
}