SWT, GCJ, semi-static binary ?

Rutger Ovidius ovid@mailandnews.com
Sun Aug 17 05:56:00 GMT 2003


Hello,
I want to release a gcj compiled binary of an swt application.
It would be nice if this linux binary worked on other people's system.
So, I attempt the following (I do not want a ton of shared libraries, I'm 
looking for a binary as "static" as possible):
--
gcj -fjni -c -O swt.jar
gcj -fjni -c -O swt-pi.jar
gcj -c -O <other.jars>
gcj --main=p.m.g2gui.v.G2gui -o g2gui *.o -L. -lswt-gtk-2135
-lswt-pi-gtk-2135
--
Wonderful. I get a working binary that should only require those ever
present libswt*gtk-2135.so shared libs ... but.. when I strace it:
open("./tls/i686/mmx/lib-g2gui", O_RDONLY) = -1 ENOENT (No such file or 
directory)
open("./tls/i686/lib-g2gui", O_RDONLY) = -1 ENOENT (No such file or 
directory)
open("./tls/mmx/lib-g2gui", O_RDONLY) = -1 ENOENT (No such file or 
directory)
open("./lib-g2gui", O_RDONLY) = -1 ENOENT (No such file or 
directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
etc..
What the heck is lib-g2gui? I don't have one.. Why is it looking for
it? I get someone else to run this binary on their system, and they
can't since the executable is missing this mysterious library that I don't
even have. But, the executable works nicely for me. I don't understand this.
"ldd g2gui" makes no mention of it. Any ideas?
Adding "-static" to the "gcj --main.." line can sometimes result in a
binary! .. that segfaults.
So, I get frustrated and move on to something else that concerns me...
Not everyone has libgcj. So, I'd like to compile it in. (Is this
worthwhile? Not everyone will have a matching libc version anyway,
right? I'm not really sure about this.. I just want a binary as
portable as possible)
I downloaded gcc-3.3.1 sources.. "./configure --disable-shared & make" and I
notice: ./i686-pc-linux-gnu/libjava/.libs/libgcj.a at 96 megs or so.
Ok, nice I suppose. "strip"ped it will be ~8 megs.
But what do I do with it? Was this the right way to make it? I can't
seem to perform any magic to turn /usr/share/java/libgcj-3.3.1.jar into
a static library.
If I try to link it in while it is at 96 megs, (I first hide my
/usr/lib/libgcj.so.4) I get a "collect2: ld terminated with signal 11
[Segmentation fault]". If I "strip" it, and try to link
it in, my whole rh9 linux box decides to quietly lockup after a few
minutes. No log messages, just gone...
(I did read _many_ of the messages on this list.. I'm not quite sure
what kind of magic potion is used to get this working:
http://gcc.gnu.org/ml/java/2003-07/msg00001.html, but I wish I had the
recipe)
I can make nice binaries on Windows with the "thisiscool" package. The
resulting executable does require swt*.dll, but nothing else. (is
there any text on how to link that dll into the exe - in nice "linking for 
dummies" language?) That seems a lot closer to "portable" than my linux 
trials...
I'm curious to know what wrong turn I've taken... I really want to get a 
working binary out to the millions clamouring for this app. ( ;-) )


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /