[Lazarus] Size of binaries etc.

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Wed Mar 21 14:15:19 CET 2012


Martin wrote:
> 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.

4,367,408 on 0.9.30.4, no change if stripped.

3,436,684 on trunk (a few days old), no change if stripped.

FPC 2.6.0, compiled with  -O- -gl  (i.e. no explicit smartlinking etc.).

> 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....)

Noted, but not something I'd much like to do for a project being 
published since it would leave me open to a lot of questions if somebody 
tried to recompile and got a wildly different size.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list