Thread: [Java-gnome-developer] undefined reference to `org::gnu::gtk::Entry::class$'
Brought to you by:
afcowie
From: Jean-Christian de R. <jc...@ec...> - 2006-11-24 14:28:50
Attachments:
Simple.java
|
Hello, I begin to learn gnome-java by the traditional Hello World like the one found into the documentation. The small code is in attachement and I can run it fine with the following command on a fresh install of Ubuntu edgy: jcdr@citron:~/workspace/Simple$ LD_PRELOAD=/usr/lib/jni/libglibjni-0.4.so java -cp bin/:/usr/share/java/gtk2.10.jar:/usr/share/java/glib0.4.jar:/usr/share/java/glade2.12.jar ch.eclis.test.Simple Now I try to compile the application to get a native ELF executable but after several test, I still can't reach this goal. The most advanced result I have is with the following command: jcdr@citron:~/workspace/Simple$ LANG=US gcj-4.1 --classpath=/usr/share/java/gtk2.10.jar:/usr/share/java/glib0.4.jar:/usr/share/java/glade2.12.jar -L /usr/lib/jni -lglibjni-0.4 -lgtkjni-2.10 -lgladejni-2.12 /usr/lib/gcj/gtk2.10.jar.so src/ch/eclis/test/Simple.java /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crt1.o: In function `_start': (.text+0x18): undefined reference to `main' /tmp/ccxGaPRd.o: In function `ch::eclis::test::Simple::Simple()': Simple.java:(.text+0x8b): undefined reference to `org::gnu::glade::LibGlade::class$' Simple.java:(.text+0xaa): undefined reference to `org::gnu::glade::LibGlade::LibGlade(java::lang::String*, java::lang::Object*)' Simple.java:(.text+0xd6): undefined reference to `org::gnu::gtk::Entry::class$' /tmp/ccxGaPRd.o:(.data+0x34): undefined reference to `org::gnu::gtk::Entry::class$' collect2: ld returned 1 exit status Using -fjni option give the same result. I have found the symbol _ZN3org3gnu3gtk5Entry7class$$E in the /usr/lib/gcj/gtk2.10.jar.so, are the one supposed to match the org::gnu::gtk::Entry::class$ ? As for the glade symbols, I didn't find a glade*.jar.so or something like this. >From what package it is supposed to come with ? Thanks in advance to any help, |
From: Andrew O. <ove...@re...> - 2006-11-24 16:09:06
|
On Fri, 2006-24-11 at 16:29 +0100, Jean-Christian de Rivaz wrote: > jcdr@citron:~/workspace/Simple$ LANG=3DUS gcj-4.1 > --classpath=3D/usr/share/java/gtk2.10.jar:/usr/share/java/glib0.4.jar:/us= r/share/java/glade2.12.jar -L /usr/lib/jni -lglibjni-0.4 -lgtkjni-2.10 -lgl= adejni-2.12 /usr/lib/gcj/gtk2.10.jar.so src/ch/eclis/test/Simple.java You're mixing the old C++ ABI and the new BC-ABI. The .jar.so file is a BC-ABI .so. You'll need to add -findirect-dispatch to your compilation line to make that work. However, you should probably read about the BC-ABI and gcj-dbtool. I don't have any pointers OTTOMH, but google should probably find some stuff. HTH, Andrew |
From: Jean-Christian de R. <jc...@ec...> - 2006-11-27 14:28:20
|
Thanks for you response, I did't know about the ABI species. I finally get my stuff working, but the result raised two new questions: 1) I did not success removing completely the JNI stuff. For exemple I=20 can compile fine with the following command an application that only use=20 GTK: gcj --classpath=3D/usr/share/java/gtk2-10.jar:/usr/share/java/glib0.4=20 /usr/lib/gcj/gtk2.10.jar.so /usr/lib/gcj/glib0.4.jar.so=20 --main=3Dch.eclis.ch.test.Simple -o Simple src/ch/eclis/test/Simple.java But it run fine only if I use the command: LD_LIBRARY_PATH+=3D/usr/lib/jni ./Simple Without the LD_LIBRARY_PATH I get this message: Exception in thread "main" java.lang.UnsatisfiedLinkError:=20 libgtkjni-2.10: libglibjni-0.4.so cannot open shared object file: No=20 such file or directory I did not understand why the GCJ library still make the JNI stuff=20 required. I that normal or I still make someting wrong ? 2) If I understand correctly the packages that provids a GCJ library=20 have to install at least 2 files: a classmap *.db file (under=20 /usr/share/gcj/classmap.d/ on the Ubuntu Edgy) and a library *.jar.so=20 file (under /uar/lib/gcj/ on the Ubuntu Edgy). This is at least what I=20 can see in all packages I have, with the exception of the=20 libglade-java-gcj package that install a classmap *.db file but no=20 library *.jar.so file at all. This sound very strange to me because the=20 classmap point to a /usr/lib/gcj/glade2.12.jar.so file that is not=20 included into the libglade-java-gcj package. This can be a Ubuntu Edgy specific issue. But I want to know if there is=20 something special I did't understand or if this is a real issue. Thanks, -- Jean-Christian Andrew Overholt a =E9crit : > On Fri, 2006-24-11 at 16:29 +0100, Jean-Christian de Rivaz wrote: >=20 >>jcdr@citron:~/workspace/Simple$ LANG=3DUS gcj-4.1 >>--classpath=3D/usr/share/java/gtk2.10.jar:/usr/share/java/glib0.4.jar:/= usr/share/java/glade2.12.jar -L /usr/lib/jni -lglibjni-0.4 -lgtkjni-2.10 = -lgladejni-2.12 /usr/lib/gcj/gtk2.10.jar.so src/ch/eclis/test/Simple.java >=20 >=20 > You're mixing the old C++ ABI and the new BC-ABI. The .jar.so file is > a BC-ABI .so. You'll need to add -findirect-dispatch to your > compilation line to make that work. However, you should probably read > about the BC-ABI and gcj-dbtool. I don't have any pointers OTTOMH, but > google should probably find some stuff. >=20 > HTH, >=20 > Andrew --=20 Jean-Christian de Rivaz |
From: Andrew O. <ove...@re...> - 2006-11-27 15:19:14
|
Hi, On Mon, 2006-27-11 at 15:29 +0100, Jean-Christian de Rivaz wrote: >=20 > gcj --classpath=3D/usr/share/java/gtk2-10.jar:/usr/share/java/glib0.4=20 > /usr/lib/gcj/gtk2.10.jar.so /usr/lib/gcj/glib0.4.jar.so=20 > --main=3Dch.eclis.ch.test.Simple -o Simple src/ch/eclis/test/Simple.java >=20 > [...] >=20 > I did not understand why the GCJ library still make the JNI stuff=20 > required. I that normal or I still make someting wrong ? I'm sorry, I really don't know about that one. I don't think one can get rid of the JNI library requirements without actually linking in all of them as well. I still don't understand how your gcj invocation above is working. Don't you need -findirect-dispatch if you're using the .jar.so files? > libglade-java-gcj package that install a classmap *.db file but no=20 > library *.jar.so file at all. This sound very strange to me because the=20 > classmap point to a /usr/lib/gcj/glade2.12.jar.so file that is not=20 > included into the libglade-java-gcj package. Yeah, that sounds fishy to me. Andrew |
From: Andrew C. <an...@op...> - 2006-11-28 00:05:13
|
On Mon, 2006-11-27 at 15:29 +0100, Jean-Christian de Rivaz wrote: > I did not understand why the GCJ library still make the JNI stuff=20 > required. I tried linking the java-gnome jni.so libraries into my executable once, but I couldn't get it to work. If I had to guess, it's because System.loadLibrary() seems to require that there be a separate library be findable by dlopen() at runtime by name. You'd think, though, that libgcj would have hacked theirs up so that it could find its symbols linked in to the final binary. Maybe someone smarter than me can point out how to do it right. Interestingly, although the library as a whole gets loaded, Sun's JVM does the symbol lookups on a class by class basis. Try java -verbose:jni MyProgram sometime. And try doing ldd ./myprogram on a java-gnome binary built with GCJ. It's quite the monster list, so somehow removing the JNI .so's wouldn't really change much. > This could be an Ubuntu Edgy specific issue.=20 Be aware that Ubuntu is out of date: https://launchpad.net/distros/ubuntu/+source/glib-java/+bug/70113/ so Ubuntu users need to show some of that Ubuntu magic that Ubuntu lovers are always going on about and get some new java-gnome packages made up! AfC Singapore --=20 Andrew Frederick Cowie Technology strategy, managing change, establishing procedures, and executing successful upgrades to mission critical business infrastructure. http://www.operationaldynamics.com/ Sydney New York Toronto London |