This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Kde-java] GCJ and qtjava/kdejava


On Saturday 30 March 2002 10:44 pm, Tom Tromey wrote:
> >>>>> "Anthony" == Anthony Green <green@redhat.com> writes:
>
> Anthony> I've copied java@gcc.gnu.org just in case somebody recognizes
> Anthony> the failure you've describe below.
>
> Not offhand.
>
> Anthony> However, in general I would say that the focus these days is
> Anthony> on the coming 3.1 release (in ~2 weeks?).
>
> Yes.  I urge you to try the current 3.1 branch with your application.
> Right now building the 3.1 branch works on a lot of platforms; you're
> unlikely to run into a problem building it.
>
> Anthony> I believe there were a number of JNI bugs fixed between 3.0.x
> Anthony> and 3.1, and fixes are unlikely to be rolled back into the
> Anthony> 3.0.x tools.
>
> Based on the stack trace I don't think this is a JNI problem.
> I would really like to know if it is fixed in 3.1.  If not, perhaps we
> can fix it -- but only if we move very quickly.
Thanks for the responses to my problem - I've joined the java@gcc.gnu.org list 
now.

I've downloaded and built a gcc-20020325 snapshot, and it has the same bug :-(. 
The only difference was that gcc 3.1 trashed the stack when it crashed.

Here is a minimal test program that reproduces the crash:

import org.kde.qt.*;

class Test1 {

public static void main(String[] args) {
        QApplication app = new QApplication(args);
        QPopupMenu mypopup = new QPopupMenu();
        mypopup.insertItem( "&Load", (QWidget) null, Qt.SLOT( "slotLoad()" ) 
);
        app.setMainWidget(mypopup);
        app.exec();
        return;
}

static {
        qtjava.initialize();
}

}

drwxrwxr-x duke/wheel        0 2002-04-01 10:18:59 testgcj/
-rw-rw-r-- duke/wheel      325 2002-04-01 09:25:17 testgcj/Test1.java
-rw-rw-r-- duke/wheel     4775 2002-04-01 10:15:01 testgcj/Test1.nm
-rw-rw-r-- duke/wheel    18675 2002-04-01 09:36:03 testgcj/Test1.objdump
-rw-rw-r-- duke/wheel    33543 2002-04-01 10:12:43 testgcj/QPopupMenu.nm
-rw-rw-r-- duke/wheel   263335 2002-04-01 10:09:27 testgcj/QPopupMenu.objdump
-rw-rw-r-- duke/wheel    11290 2002-04-01 10:18:54 testgcj/QPopupMenu.java

I've attached the source of Test1.java, and the source of QPopupMenu.java 
where the insertItem() native methods are declared. I produced some 
diagnostics with binutils 2-12 as follows:

objdump -dS QPopupMenu.o > QPopupMenu.objdump
objdump -dS Test1 > Test1.objdump

nm --demangle QPopupMenu.o > QPopupMenu.nm
nm --demangle Test1 > Test1.nm

QPopupMenu.o was compiled with '-g -fPIC -fjni' flags. Sorry about the large 
attachment if this doesn't help.

As I didn't get a stack trace, I tried a Qt Hello World program:

import org.kde.qt.*;

class Hello {

public static void main(String[] args) {
        QApplication app = new QApplication(args);
        QLabel mylabel = new QLabel("Hello World", null);
        mylabel.resize(120, 30);
        app.setMainWidget(mylabel);
        mylabel.show();
        app.exec();
        return;
}

static {
        qtjava.initialize();
}

}

It crashed on the line 'app.setMainWidget(mylabel);', because it tried to call 
QApplication.locked() rather than setMainWidget():

tipitina duke 920% Hello
Exception in thread "main" java.lang.UnsatisfiedLinkError: locked
   at 0x0f6f9ef8: java.lang.Throwable.Throwable(java.lang.String) 
(/usr/local/lib/libgcj.so.3)
   at 0x0f6e82b8: java.lang.Error.Error(java.lang.String) 
(/usr/local/lib/libgcj.so.3)
   at 0x0f6ea704: java.lang.LinkageError.LinkageError(java.lang.String) 
(/usr/local/lib/libgcj.so.3)
   at 0x0f6fa0bc: 
java.lang.UnsatisfiedLinkError.UnsatisfiedLinkError(java.lang.String) 
(/usr/local/lib/libgcj.so.3)
   at 0x0f6a9318: _Jv_LookupJNIMethod (/usr/local/lib/libgcj.so.3)
   at 0x0fec0be8: org.kde.qt.QApplication.locked() 
(/opt/kde3/lib/lib-org-kde-qt.so)
   at 0x10001ca4: Hello::main(JArray<java::lang::String*>*) 
(/local/src/kde/kdebindings/qtjava/javalib/test/Hello.java:10)
   at 0x0f6ce140: gnu.gcj.runtime.FirstThread.call_main() 
(/usr/local/lib/libgcj.so.3)
   at 0x0f762320: gnu.gcj.runtime.FirstThread.run() 
(/usr/local/lib/libgcj.so.3)
   at 0x0f6daa64: _Jv_ThreadRun(java.lang.Thread) (/usr/local/lib/libgcj.so.3)
   at 0x0f6a5f20: _Jv_RunMain(java.lang.Class, byte const, int, byte const, 
boolean) (/usr/local/lib/libgcj.so.3)
   at 0x0f6a6048: JvRunMain (/usr/local/lib/libgcj.so.3)
   at 0x10001bb4: main (/tmp/ccaJpo9l.i:12)

-- Richard


Attachment: testgcj.tar.gz
Description: application/tgz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]