I can make your gcj-compiled binaries much smaller.
Dhek Bhun Kho
bhun@chello.nl
Thu Jan 16 00:08:00 GMT 2003
> Oh yeah, and it's a great thing. Trouble is, you're threatening to
> make static linkage useful! That means people will use it, and then
> ... we have support headaches.
Why does it make support worse?
I haven't dug into all the code yet, as I am waiting for my paperwork to
come through. (I was hoping to work out the rmi part, seems fun as it
coincides with my scjd assignment)
I did find static linkage a lot easier to port apps. The bzipped size of
a static ant is just 3 MB, and it reduces startup time immensely (like
400%). I know classes get left out if you use a static library to link
the binary, but I just passed all the object files to the linker. The
only classes that can gcj can 'forget' are from the gcj distribution
itself, which are supposed to be contained withing the libgcj-3.x.jar
isn't it? I haven't got any problems with a 9 MB big ant actually. At
the moment it's the only way to circumvent small glitches in the libgcj
dso and distribute a binary that will 'just work'.
I just can't expect people (friends etc.) to get the gcc sources or
checkout cvs, patch it themselves, and recompile libjava. I reworked the
object compilation script to be more simple and generic and it works for
me.
Is there anyway to checkout if external sources are already included in
the libjava distribution, so you can leave them out during compilation
and linking (assuming the interfaces are compatible)?
The only way I can think of at the moment is just feed a small java
executable like:
public static void main(String[] args) {
try { Class.forName(args[0]) } catch (Exception e) { System.exit(1); }
System.exit(0);
}
And use that in a compilation script to check out whether or not the
script (or makefile script) should include a class during compilation.
Is there another way?
I tend to avoid Java classes all together, they just give me headaches
about not being able to merge the code (haven't checked it out yet).
At the moment I use a script that only generates the native objects, and
I link manually. I don't know whether it's of any use, but I included it
in the posting. I found the -O flags a bit useless for the java
applications as most of them aren't very computational intensive (they
just do a lot :D), no significant difference was found to drive an Ant
build statically built with either -Os or -O0, but it does cut down the
binary with 3 MB.
> I'm not opposed to your plans. However, they raise some, er,
> interesting questions...
Please explain. I'd like to know.
> Andrew.
--- The college graduate is presented with a sheepskin to cover his
intellectual nakedness. -- Robert M. Hutchins
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compile
Type: text/x-sh
Size: 3027 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20030116/2142eacb/attachment.bin>
More information about the Java
mailing list