[Lazarus] Size of binaries etc.

Bernd prof7bit at googlemail.com
Fri Mar 23 20:38:58 CET 2012

2012/3/21 Mark Morgan Lloyd <markMLl.lazarus at telemetry.co.uk>:
> On Linux x86 (Debian "Squeeze") with gtk2, freshly-created minimal project
> with full optimisation, no debug, optimise for minimum size and smart
> linking comes to 3,459,960 bytes.
> That's... such a disparity from what I've been told to expect that I'd
> appreciate any suggestions as to where I should be looking for problems.

You must be doing something wrong. On i386-linux/GTK2 with everything
smart-linkable and smart-linked and stripped I get 2MB (2113600 bytes)
for a minimal application with only one button and one label.
(everything compiled with -g- -O3 -CX -XX -Xs)

With upx the 2MB go down to 700kB, without smart-linking I get around 4MB.

Make sure while you are compiling your project in Lazarus you also
have -CX in the options of the "build lazarus" Dialog because
otherwise when compiling your project it will automatically
(re-)compile the LCL without smartlinking. It will always recompile
(if necessary) the LCL and all dependent units with the settings that
are currently active for "build lazarus" whenever you compile a

(I discovered this by accident but it is quite useful: I always
thought I had to explicitly recompile the entire Lazarus after
changing these options but it is enough to just change the options and
then only recompile your project)


More information about the Lazarus mailing list