Reducing static binary sizes

Andrea Aime a.aime@satanet.it
Tue Jan 10 10:35:00 GMT 2006


Anthony Green wrote:
> On Sun, 2006年01月08日 at 09:44 +0100, Andrea aime wrote:
>>> Cool, thank you Adam, I'll try it and report back where I got with 
>> executable size reduction. In the meantime, can someone more knowledgeable
>> tell the poor java programmer if it's possible to link a different version
>> of the runtime library (a stripped one, for example) instead of the
>> standard libgjc? I've tried to read the gcj online manual, but didn't have
>> much luck...
>>> If I understand your question, then yes. Just link normally with gcj -v.
> The -v option tells the compiler to be verbose about what it's doing. Look
> at the list of objects files and libraries that it uses in the link. Then
> link again, this time with gcj -nostdlib and use that entire list of object
> files and libraries, simply replacing -lgcj with your own version.

I've tried following your suggestions. I've created a shrinked version of
all my libraries plus gcj with gcclass, resulting in a single jar file.
Then tried to compile with -v, removed -lgcj and added -nostdlib and all
the libraries usually linked by gcj (quite a lot, I wonder if they're all
necessary), but now gcj complains he has not .spec file to refer to.
I've tried to point it to the standard spec file I've found into the gcj
distribution I'm using, but it does not work. I get an error about a rename
directive at the top of the file, which I suspect is due to the modification
performed in the thisiscool.com distribution, removed the rename directive and
now gcj complains it doesn't know about jc1.exe... specifying the full jc1.exe
path in the spec file does not help...
Can you give me some indication on how to build a working spec file?
Best regards
Andrea Aime


More information about the Java mailing list

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