[kaffe] java.lang.UnsatisfiedLinkError: not enough memory
Ito Kazumitsu
kaz@maczuka.gcd.org
Fri May 16 15:49:02 2003
The problem is
AWT cannot be used with kaffe on FreeBSD (mine is 4.7-RELEASE).
As I see it from the backtrace list of gdb (attached below), there may be
something wrong in libltdl/ltdl.c.
To make things simple, I made a simple program (taken from
http://www.asahi-net.or.jp/~dp8t-asm/java/tips/AppFrameHelloWorld.html).
import java.awt.*;
class AWTTest extends Frame {
public static void main(String args[]) {
try {
AWTTest app =3D new AWTTest();
app.show();
}
catch (Exception e) {
e.printStackTrace();
}
}
AWTTest() {
setSize(100, 70);
}
public void paint(Graphics g) {
g.drawString("Hello World!!", 20, 50);
}
}
Then I made kaffe with the following options:
CPPFLAGS=3D"-I/usr/local/include" CFLAGS=3D"-g" LIBS=3D"-L/usr/local/lib -l=
dlmalloc" ./configure --with-libiconv-prefix=3D/usr/local --enable-debug
Here I used Doug Lea's malloc-2.7.2 instead of FreeBSD's malloc
because the former is more convenient for debugging (Doug Lea's
dumps core when error occurs while FreeBSD's only shows a warning
message).
Then I run
bash-2.05b$ java -vmdebug ALL AWTTest > vmdebug.log 2>&1 =20
Bus error (core dumped)
bash-2.05b$ gdb /usr/local/kaffe/jre/bin/kaffe-bin kaffe-bin.core=20
GNU gdb 4.18 (FreeBSD)
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain condition=
s.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-unknown-freebsd"...Deprecated bfd_read cal=
led at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dbxrea=
d.c line 2627 in elfstab_build_psymtabs
Deprecated bfd_read called at /usr/src/gnu/usr.bin/binutils/gdb/../../../..=
/contrib/gdb/gdb/dbxread.c line 933 in fill_symbuf
Core was generated by `kaffe-bin'.
Program terminated with signal 10, Bus error.
Reading symbols from /usr/local/kaffe/jre/lib/i386/libkaffevm-1.1.x-cvs.so.=
..
done.
Reading symbols from /usr/lib/libm.so.2...done.
Reading symbols from /usr/local/lib/libiconv.so.3...done.
Reading symbols from /usr/lib/libc.so.4...done.
Reading symbols from /usr/local/kaffe/jre/lib/i386/libnative-1.1.x-cvs.so...
done.
Reading symbols from /usr/local/kaffe/jre/lib/i386/libio-1.1.x-cvs.so...don=
e.
Reading symbols from /usr/libexec/ld-elf.so.1...done.
#0 0x2827988d in memcpy () from /usr/lib/libc.so.4
(gdb) bt
#0 0x2827988d in memcpy () from /usr/lib/libc.so.4
#1 0x28 in ?? ()
#2 0x280bd6c0 in rpl_argz_append (pargz=3D0xbfbfd15c, pargz_len=3D0xbfbfd1=
58,=20
buf=3D0x817e7e9 "/usr/X11R6/lib", buf_len=3D15) at ltdl.c:581
#3 0x280bd99f in rpl_argz_insert (pargz=3D0xbfbfd15c, pargz_len=3D0xbfbfd1=
58,=20
before=3D0x0, entry=3D0x817e7e9 "/usr/X11R6/lib") at ltdl.c:680
#4 0x280c0f65 in lt_argz_insert (pargz=3D0xbfbfd15c, pargz_len=3D0xbfbfd15=
8,=20
before=3D0x0, entry=3D0x817e7e9 "/usr/X11R6/lib") at ltdl.c:3524
#5 0x280c20e3 in lt_dlpath_insertdir (ppath=3D0x281049a4, before=3D0x0,=20
dir=3D0x817e7e9 "/usr/X11R6/lib") at ltdl.c:3981
#6 0x280c21e5 in lt_dladdsearchdir (search_dir=3D0x817e7e9 "/usr/X11R6/lib=
")
at ltdl.c:4006
#7 0x280bf84d in load_deplibs (handle=3D0x814fcd8,=20
deplibs=3D0x817e7c0 " -L/usr/local/lib -ljpeg -lpng -lz -lm -L/usr/X11R=
6/lib") at ltdl.c:2837
#8 0x280c077d in try_dlopen (phandle=3D0xbfbfd2b4,=20
filename=3D0x8192350 "/usr/local/kaffe/jre/lib/i386/libawt.la")
at ltdl.c:3302
#9 0x280c0d37 in lt_dlopenext (
filename=3D0xbfbfd3e8 "/usr/local/kaffe/jre/lib/i386/libawt") at ltdl.c=
:3466
#10 0x28093715 in loadNativeLibrary2 (
path=3D0xbfbfd3e8 "/usr/local/kaffe/jre/lib/i386/libawt", default_refs=
=3D1,=20
errbuf=3D0xbfbfd368 "\a", errsiz=3D128) at external.c:251
#11 0x280935a6 in loadNativeLibrary (
lib=3D0xbfbfd3e8 "/usr/local/kaffe/jre/lib/i386/libawt",=20
errbuf=3D0xbfbfd368 "\a", errsiz=3D128) at external.c:191
#12 0x2836d346 in java_lang_NativeLibrary_linkLibrary (jpath=3D0x8195800)
at NativeLibrary.c:67
#13 0x812c1e7 in ?? ()
#14 0x8122a70 in ?? ()
#15 0x811b326 in ?? ()
#16 0x81054af in ?? ()
#17 0x8183119 in ?? ()
#18 0x280b9494 in sysdepCallMethod (call=3D0xbfbfdb54)
at ../../config/i386/common.h:38
#19 0x280b87f1 in callMethodA (meth=3D0x8190c70, func=3D0x8189178, obj=3D0x=
0,=20
args=3D0x0, ret=3D0xbfbfd94c, promoted=3D0) at support.c:606
#20 0x280a60c3 in Kaffe_CallStaticVoidMethodA (env=3D0x281043f0, cls=3D0x81=
7b5e0,=20
meth=3D0x8190c70, args=3D0x0) at jni.c:2397
#21 0x2807c5d9 in processClass (class=3D0x817b5e0, tostate=3D11, einfo=3D0x=
bfbfdd1c)
at classMethod.c:481
#22 0x280b2865 in soft_fixup_trampoline (_data=3D0x81933d5) at soft.c:575
#23 0x280efe7e in i386_do_fixup_trampoline () at machine.c:1187
#24 0x8179c85 in ?? ()
#25 0x8184847 in ?? ()
#26 0x280b9494 in sysdepCallMethod (call=3D0xbfbfe010)
at ../../config/i386/common.h:38
#27 0x280b87f1 in callMethodA (meth=3D0x8175740, func=3D0x81729d0, obj=3D0x=
0,=20
args=3D0x0, ret=3D0xbfbfde08, promoted=3D0) at support.c:606
#28 0x280a60c3 in Kaffe_CallStaticVoidMethodA (env=3D0x281043f0, cls=3D0x81=
57ea0,=20
meth=3D0x8175740, args=3D0x0) at jni.c:2397
#29 0x2807c5d9 in processClass (class=3D0x8157ea0, tostate=3D11, einfo=3D0x=
bfbfe1d0)
at classMethod.c:481
#30 0x280b1b26 in soft_new (c=3D0x8157ea0) at soft.c:49
#31 0x8197441 in ?? ()
#32 0x280b9494 in sysdepCallMethod (call=3D0xbfbfe498)
at ../../config/i386/common.h:38
#33 0x280b87f1 in callMethodA (meth=3D0x8156d48, func=3D0x81724a8, obj=3D0x=
0,=20
args=3D0x0, ret=3D0xbfbfe290, promoted=3D0) at support.c:606
#34 0x280a60c3 in Kaffe_CallStaticVoidMethodA (env=3D0x281043f0, cls=3D0x81=
57e00,=20
meth=3D0x8156d48, args=3D0x0) at jni.c:2397
#35 0x2807c5d9 in processClass (class=3D0x8157e00, tostate=3D11, einfo=3D0x=
bfbfe65c)
at classMethod.c:481
#36 0x280b27ba in soft_initialise_class (c=3D0x8157e00) at soft.c:547
#37 0x816bc30 in ?? ()
#38 0x8157d1e in ?? ()
#39 0x280b9494 in sysdepCallMethod (call=3D0xbfbfe934)
at ../../config/i386/common.h:38
#40 0x280b87f1 in callMethodA (meth=3D0x8142a60, func=3D0x8159ec8, obj=3D0x=
0,=20
args=3D0x0, ret=3D0xbfbfe72c, promoted=3D0) at support.c:606
#41 0x280a60c3 in Kaffe_CallStaticVoidMethodA (env=3D0x281043f0, cls=3D0x81=
38cc0,=20
meth=3D0x8142a60, args=3D0x0) at jni.c:2397
#42 0x2807c5d9 in processClass (class=3D0x8138cc0, tostate=3D11, einfo=3D0x=
bfbfebb8)
at classMethod.c:481
#43 0x2807c399 in processClass (class=3D0x8138680, tostate=3D11, einfo=3D0x=
bfbfebb8)
at classMethod.c:415
#44 0x2807c399 in processClass (class=3D0x8138220, tostate=3D11, einfo=3D0x=
bfbfebb8)
at classMethod.c:415
#45 0x2836c20d in java_lang_ClassLoader_resolveClass0 (this=3D0x811ad48,=20
class=3D0x8138220) at ClassLoader.c:130
#46 0x81450b5 in ?? ()
#47 0x812b2a8 in ?? ()
#48 0x81392a2 in ?? ()
#49 0x813a769 in ?? ()
#50 0x811c9b9 in ?? ()
#51 0x280b94b0 in sysdepCallMethod (call=3D0xbfbfef30)
at ../../config/i386/common.h:45
#52 0x280b8d9d in callMethodV (meth=3D0x8091060, func=3D0x811c980, obj=3D0x=
0,=20
args=3D0xbfbff0b0 "/", ret=3D0xbfbff024) at support.c:826
#53 0x280b7ed7 in do_execute_java_class_method_v (
cname=3D0x280fd40e "java.lang.Class", loader=3D0x0,=20
method_name=3D0x280fd406 "forName",=20
signature=3D0x280fd3e0 "(Ljava/lang/String;)Ljava/lang/Class;",=20
argptr=3D0xbfbff0ac "=EF=BF=BD\022\b/") at support.c:237
#54 0x280b7f27 in do_execute_java_class_method (
cname=3D0x280fd40e "java.lang.Class", loader=3D0x0,=20
method_name=3D0x280fd406 "forName",=20
signature=3D0x280fd3e0 "(Ljava/lang/String;)Ljava/lang/Class;")
at support.c:261
#55 0x2809e774 in Kaffe_FindClass (env=3D0x281043f0, name=3D0xbfbff71c "AWT=
Test")
at jni.c:347
#56 0x8048be8 in main2 (env=3D0x281043f0, argv=3D0xbfbff5e8, farg=3D4, argc=
=3D0)
at main.c:206
#57 0x8048b79 in main (argc=3D1, argv=3D0xbfbff5e8) at main.c:145
#58 0x8048979 in _start ()
(gdb)=20
I put vmdebug.log at
http://www.jsdi.or.jp/~maczuka/kaffe/vmdebug.log.gz
Please check.