[Lazarus] Size of binaries etc.

Marco van de Voort marcov at stack.nl
Wed Mar 21 21:19:12 CET 2012

On Wed, Mar 21, 2012 at 10:42:23AM +0000, Mark Morgan Lloyd wrote:
> Before anything else: I've read and digested the wiki page on binary 
> size, and the related FAQ entry.

> I'm knocking together a couple of programs in Lazarus to do jobs 
> relating to IBM mainframes, partly because the existing tools run only 
> on Windows, and partly to showcase Lazarus's capabilities in the 
> mainframe community.
> 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.

With (some version of) Lazarus, or with the current version ? :-)

Older versions are smaller, also with Lazarus. And, as with older Delphi's
essentially unsupported.

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

Yes. 300 of them are 1 GB, about $0.1 worth of harddisk space at $100/TB.
Uncompressed.  About a buck if you use enterprise discs.
> The FPC I'm using has been built from source, but I see I'm not using 
> OPT='-CX' or similar... should I be?

-CX to build units and -XX to use programs (and both for a combination).

The -CX is the "compile" part, -XX is the hint to the linker.
> 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?

Debug info (-Xs aka strip) and smartlinking  (-CX -XX) are the main ones.

The -XXs sometimes fails with some external linker versions. When in doubt,
manually use the strip command, except on windows targets.

More information about the Lazarus mailing list