Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2021-04

How to reduce size of lazarus itself?

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bo Berglund

I just checked out 2.0.12 on a RaspberryPi4 and built it using my existing fpc 3.2.0.
The size of the executable is 271,368,224 bytes, which reduces to 30,127,876 after using strip -s on it (takes away all the symbols).

Since I am never ever going to be debugging lazarus itself, is there some setting I can use to NOT include the symbols in the first place? I want a lean and fast binary...

Obviously since Lazarus rebuilds itself when packages are installed in the IDE, this setting must be part of the installation somehow.

Bo Berglund Developer in Sweden

Reply by email

Martin Frb
to Bo Berglund
Bo Berglund wrote 13 lines
I just checked out 2.0.12 on a RaspberryPi4 and built it using my existing fpc 3.2.0. The size of the executable is 271,368,224 bytes, which reduces to 30,127,876 after using strip -s on it (takes away all the symbols). Since I am never ever going to be debugging lazarus itself, is there some setting I can use to NOT include the symbols in the first place? I want a lean and fast binary... Obviously since Lazarus rebuilds itself when packages are installed in the IDE, this setting must be part of the installation somehow.

Settings are taken from Tools > configure build lazarus.

Put
-O3 -g-

in there.

Reply by email

Bo Berglund
to Martin Frb
Martin Frb wrote 20 lines
On 08/04/2021 23:24, Bo Berglund via lazarus wrote: > I just checked out 2.0.12 on a RaspberryPi4 and built it using my existing fpc > 3.2.0. > The size of the executable is 271,368,224 bytes, which reduces to 30,127,876 > after using strip -s on it (takes away all the symbols). > > Since I am never ever going to be debugging lazarus itself, is there some > setting I can use to NOT include the symbols in the first place? > I want a lean and fast binary... > > Obviously since Lazarus rebuilds itself when packages are installed in the IDE, > this setting must be part of the installation somehow. > > Settings are taken from Tools > configure build lazarus. Put -O3 -g- in there.

So I did this on my RPi4 and it worked fine, the executable is now not in need of strip -s anymore.

But when I tried to do the same on my Windows Lazarus 2.0.8 it resulted in Lazarus now starting up with ONLY the code editor window and the top Lazarus bar visible!
All of the other windows I have adjusted around the code editor are gone! No more Object inspector, Messages, Project Inspector, Code Explorer...

How come they disappeared?

In RPi4 I did this in a newly installed Lazarus where I have not yet opened a project whereas on the Windows 2.0.8 I did it in Lazarus being in use with a project loaded (which Lazarus seems always to do).

Bo Berglund Developer in Sweden

Reply by email

Bo Berglund
to Bo Berglund
Bo Berglund wrote 39 lines
On Fri, 9 Apr 2021 00:46:53 +0200, Martin Frb via lazarus wrote: >On 08/04/2021 23:24, Bo Berglund via lazarus wrote: >> I just checked out 2.0.12 on a RaspberryPi4 and built it using my existing fpc >> 3.2.0. >> The size of the executable is 271,368,224 bytes, which reduces to 30,127,876 >> after using strip -s on it (takes away all the symbols). >> >> Since I am never ever going to be debugging lazarus itself, is there some >> setting I can use to NOT include the symbols in the first place? >> I want a lean and fast binary... >> >> Obviously since Lazarus rebuilds itself when packages are installed in the IDE, >> this setting must be part of the installation somehow. >> >> >Settings are taken from Tools > configure build lazarus. > >Put >-O3 -g- > >in there. So I did this on my RPi4 and it worked fine, the executable is now not in need of strip -s anymore. But when I tried to do the same on my Windows Lazarus 2.0.8 it resulted in Lazarus now starting up with ONLY the code editor window and the top Lazarus bar visible! All of the other windows I have adjusted around the code editor are gone! No more Object inspector, Messages, Project Inspector, Code Explorer... How come they disappeared? In RPi4 I did this in a newly installed Lazarus where I have not yet opened a project whereas on the Windows 2.0.8 I did it in Lazarus being in use with a project loaded (which Lazarus seems always to do).

Luckily I have started making backups of the files in the pcp directory so I could restore the environmentoptions.xml file from the backup and now the display is OK.

Bo Berglund Developer in Sweden

Reply by email

Martin Frb
to Bo Berglund
Bo Berglund wrote 12 lines
On Fri, 09 Apr 2021 07:51:35 +0200, Bo Berglund via lazarus wrote: > But when I tried to do the same on my Windows Lazarus 2.0.8 it resulted in > Lazarus now starting up with ONLY the code editor window and the top Lazarus bar > visible! > All of the other windows I have adjusted around the code editor are gone! > No more Object inspector, Messages, Project Inspector, Code Explorer... > > How come they disappeared? >

No idea.
None of the options should affect the config.

Maybe -O3 triggers a bug, or is buggy. Try with -O2 or -O1 instead. Or try with fpc 3.2.2.

The -g- is the main factor in getting rid of the debug info. The -O* is more about execution speed.

Mind I have not checked, but I believe the following should also work (in case those options are enabled elsewhere)
-CR-r-i-o-t-   -Sa-
and
 -Si

Reply by email