--- Anthony Green <green(a)redhat.com> wrote:
On Sun, 2005-08-14 at 20:26 -0700, John M. Gabriele wrote:
> [john@localhost ~/dev/java/JOGL_Example]$ gij -cp /usr/share/java/jogl.jar
Test
> Exception in thread "main" java.lang.UnsatisfiedLinkError: libjawt: file
not
> found
> at java.lang.Runtime._load(java.lang.String, boolean)
> (/usr/lib/libgcj.so.6.0.0)
For some reason gij doesn't know where libjawt.so is. I think fitzsim
and I have discussed, but I don't recall the result.
Try doing this before running your program. It should fix it:
$ export LD_LIBRARY_PATH=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/lib/i386
> Compiling to object works also:
>
> gcj --classpath=/usr/share/java/jogl.jar -c Test.java
>
> but trying to link that fails:
>
> [john@localhost ~/dev/java/JOGL_Example]$ gcj
> --classpath=/usr/share/java/jogl.jar --main=Test -o MyTest Test.o
> Test.o(.text+0x1d): In function
> `TestRenderer::init(net::java::games::jogl::GLDrawable*)':
> Test.java: undefined reference to
`net::java::games::jogl::GLDrawable::class$'
There are two solutions:
1. Compile your code with -findirect-dispatch.
This will replace symbolic references to the jogl code with runtime name
lookups.
or
2. Link with -ljogl.jar. This will link libjogl.jar.so to your program,
which should resolve all of the jogl symbols.
Good luck!
AG
I think I'm gonna need just a bit more help.
So as not to confuse the issue, there's two different ways we're trying
to get this working here, and I'd like to get it working both ways:
1. using gcj to AOT compile then run directly, and
2. using gcj to compile to bytecode, then gij to run.
My code is just the simple code described here:
http://192.18.37.44/forums/index.php?topic=1474.0
(though I haven't yet gotten past the first few
messages on that thread)
The imports at the top look like:
import net.java.games.jogl.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
------------------- compile to native, then run directly ---------------
I built with this:
gcj --classpath=/usr/share/java/jogl.jar \
-c Test.java
(which gives me Test.o) then
gcj --classpath=/usr/share/java/jogl.jar \
--main=Test -ljogl.jar -o MyTest Test.o
[john@localhost ~/dev/java/JOGL_Example]$ ls -l
total 68
-rwxrwxr-x 1 john john 25934 Aug 15 21:24 MyTest
-rw-rw-r-- 1 john john 4873 Aug 15 21:07 Test.java
-rw-rw-r-- 1 john john 16584 Aug 15 21:24 Test.o
[john@localhost ~/dev/java/JOGL_Example]$ ldd MyTest
linux-gate.so.1 => (0x0066c000)
libjogl.jar.so => /usr/lib/libjogl.jar.so (0x0066d000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x0056f000)
libgcj.so.6 => /usr/lib/libgcj.so.6 (0x0259d000)
libm.so.6 => /lib/libm.so.6 (0x003db000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00111000)
libz.so.1 => /usr/lib/libz.so.1 (0x00407000)
libdl.so.2 => /lib/libdl.so.2 (0x00401000)
libc.so.6 => /lib/libc.so.6 (0x002af000)
/lib/ld-linux.so.2 (0x00291000)
[john@localhost ~/dev/java/JOGL_Example]$ echo $LD_LIBRARY_PATH
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/lib/i386
[john@localhost ~/dev/java/JOGL_Example]$ ls -l
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/lib/i386
total 4
lrwxrwxrwx 1 root root 23 Jul 30 01:25 libjawt.so -> /usr/lib/libgcjawt.so.6
[john@localhost ~/dev/java/JOGL_Example]$ ./MyTest
Exception in thread "main" java.lang.LinkageError: unexpected exception during
linking: net.java.games.jogl.GLCapabilities
at java.lang.VMClassLoader.transformException(java.lang.Class,
java.lang.Throwable) (/usr/lib/libgcj.so.6.0.0)
at java.lang.VMClassLoader.resolveClass(java.lang.Class)
(/usr/lib/libgcj.so.6.0.0)
at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.6.0.0)
at Test.main(java.lang.String[]) (Unknown Source)
at gnu.java.lang.MainThread.call_main() (/usr/lib/libgcj.so.6.0.0)
at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)
Caused by: java.lang.NullPointerException
at java.lang.VMClassLoader.resolveClass(java.lang.Class)
(/usr/lib/libgcj.so.6.0.0)
...4 more
----------------- compile to bytecode, then interpret -----------
Ok, I can build the bytecode like so:
gcj --classpath=/usr/share/java/jogl.jar -C Test.java
(just changing the above -c to -C)
then
[john@localhost ~/dev/java/JOGL_Example]$ echo $LD_LIBRARY_PATH
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/lib/i386
and running it actually brings up a window and draws something
which is red and flickers a bit, but doesn't look like a triangle.
Here's the nasty-looking messages that come up in my terminal
window:
[john@localhost ~/dev/java/JOGL_Example]$ gij -cp /usr/share/java/jogl.jar Test
Init GL is net.java.games.jogl.impl.x11.X11GLImpl
(.:3155): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in
cast to `GtkWidget'
(.:3155): GLib-GObject-WARNING **: invalid unclassed pointer in cast to
`GtkObject'
(.:3155): Gtk-CRITICAL **: gtk_widget_get_display: assertion `GTK_IS_WIDGET
(widget)' failed
Aborted
-------------------------
Thanks for any help,
---John
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs