SWT to libswt.a and binary size shrinking

João Garcia jgarcia@uk2.net
Wed May 12 12:10:00 GMT 2004


Hi,
Alexandr Karimov wrote:
>Exception in thread "main" org.eclipse.swt.SWTException: Unsupported or
>unrecognized format
> at 0x004f732e (Unknown Source)
> ....
>>I think that this error is connected with gif image loading...
>Yes, it is.
>>According to described above I have two questions:
>1) What can be wrong with my libswt.a and how can I patch it to eliminate
>the above Exception?
>Try the FileFormat.patch attached to this post. It is the same patch presented 
by John Murga (http://gcc.gnu.org/ml/java/2002-12/msg00147.html),
but adjusted to the new version of FileFormat.java (from SWT 3.0M8 -- 3044).
It should work fine with version 3050. Or, if not, it should be easy to 
implement 'by hand'.
> 2) Why is there so huge size difference between two compiled exe files
>(with http://www.thisiscool.com/gcc_mingw.htm and alone MinGW instance) and
>how I can shrink the generated exe to the minimum possible size?
>Because the thisiscool.com build is using several optimizations. Some of those 
are only possible if you are building the compiler/libgcj from source.
Nevertheless, you should be able to reduce the size of your binaries by using 
some compiler flags when building libswt and your own programs:
-g0 (to remove debug information)
-Os (to optimize for size)
Also attached to the current post is a build-script for libswt (based on 
John Murga's script) that uses the patch and those compiler flags.
To build libswt.a, please place the build script, the patch file, swt.jar and 
swtsrc.zip into the same directory and run the build script from the MSYS 
environment. The script was tested with swt 3.0M8. You should get a libswt.a 
about 6 MB.
I guess that you know the next tip, but someone might not... You should also 
strip your generated .exe files:
strip your_program.exe
This can also be done by using the -s linker flag.
Regards,
Joao
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: FileFormat.patch
URL: <http://gcc.gnu.org/pipermail/java/attachments/20040512/4ecb6877/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build-swt30M8.sh
Type: application/x-sh
Size: 1176 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java/attachments/20040512/4ecb6877/attachment.sh>


More information about the Java mailing list

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