* Re: About static linking with gcj
[not found] <27986041.3148981253797792277.JavaMail.root@wmail18>
@ 2009-09-24 14:57 ` Andrew Haley
2009-09-24 15:41 ` David Daney
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Haley @ 2009-09-24 14:57 UTC (permalink / raw)
To: l.civinini; +Cc: gcc-help, java
l.civinini@libero.it wrote:
> Hi all,
> I'm trying to make static linking in order to obtain a java executable
> to use on a device with few hardisk space.
> I created a simple java that made
> only a "System.out.println" and after c
> ompiling I obtained am executable file
> of 29 MB. Is it possibile to
> shrink the size of executable? Am I doing
> something worng?
> This is the command that I'm using.
>
> gcc -o Foo Foo.o Foomain.
> i -shared-libgcc -Wl,-non_shared -lgcj -Wl,-call_shared -lsupc++ -Wl,--as-
> needed -lz -lgcc_s -lpthread -lc -lm -ldl -Wl,--no-as-needed
It's difficult. The nature of the Java library is such that a lot of
stuff is required, and you'll find it gets linked in. SOme folks on the
gcc list have done work in this area, but it's tricky.
Andrew.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: About static linking with gcj
2009-09-24 14:57 ` About static linking with gcj Andrew Haley
@ 2009-09-24 15:41 ` David Daney
0 siblings, 0 replies; 2+ messages in thread
From: David Daney @ 2009-09-24 15:41 UTC (permalink / raw)
To: l.civinini; +Cc: Andrew Haley, gcc-help, java
Andrew Haley wrote:
> l.civinini@libero.it wrote:
>> Hi all,
>> I'm trying to make static linking in order to obtain a java executable
>> to use on a device with few hardisk space.
>> I created a simple java that made
>> only a "System.out.println" and after c
>> ompiling I obtained am executable file
>> of 29 MB. Is it possibile to
>> shrink the size of executable? Am I doing
>> something worng?
>> This is the command that I'm using.
>>
>> gcc -o Foo Foo.o Foomain.
>> i -shared-libgcc -Wl,-non_shared -lgcj -Wl,-call_shared -lsupc++ -Wl,--as-
>> needed -lz -lgcc_s -lpthread -lc -lm -ldl -Wl,--no-as-needed
>
> It's difficult. The nature of the Java library is such that a lot of
> stuff is required, and you'll find it gets linked in. SOme folks on the
> gcc list have done work in this area, but it's tricky.
>
You can use -static-libgcj since GCC-4.2.
Also you can try the patches I posted to java-patches@ recently to try
to reduce the size of the statically linked applications.
The best I have been able to achieve on GCC-4.3.4 is about 10MB.
David Daney
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-09-24 15:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <27986041.3148981253797792277.JavaMail.root@wmail18>
2009-09-24 14:57 ` About static linking with gcj Andrew Haley
2009-09-24 15:41 ` David Daney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).