[Lazarus] Size of binaries etc.

Martin lazarus at mfriebe.de
Wed Mar 21 13:06:07 CET 2012

On 21/03/2012 10:42, Mark Morgan Lloyd wrote:
> A program built using (some version of) Delphi comes to about 317Kb, 
> but even with a manual strip the best I can do with Lazarus/FPC is 
> pushing 3Mb. Now for domestic consumption I can live with that, but I 
> don't think it looks very good if I publish binaries for download, and 
> by the time I've got to several different OSes, CPUs and widget sets 
> it's taking a significant amount of storage.
> The FPC I'm using has been built from source, but I see I'm not using 
> OPT='-CX' or similar... should I be?
> The Lazarus I'm using has been built from source (make bigide). Should 
> this have extra options to force everything possible in the LCL to be 
> smartlinkable? Or once I've got the initial IDE should I be using it 
> to rebuild itself, and in that case are there any options to be set?
> Is there anything else obvious that I'm missing?

Compiling an empty form, smartlink, withdout heaptrc,  and stripped (use 
strip.exe) should come to  1.9 Mb on Lazarus trunk.

To get it further down, find initialization sections throughout the LCL, 
and disable stuff you do not need.
e.g. graphics uses units for the different gfx formats, if you do not 
use png, comment out the registration (though I am fot sure what is 
needed for icons...). That can save a few 100K if you are lucky. (Having 
that in, is the price for using RAD) (I did test this one a few years back)

Not sure, not tested, but you may also find resources included (such as 
icons) and decide you can do without, or with less. (Only guessing....)

More information about the Lazarus mailing list