[Lazarus] Can I configure Lazarus (or the project) to only add symbols on debug?

Dimitrios Chr. Ioannidis d.ioannidis at nephelae.eu
Mon Dec 13 21:34:55 CET 2021


Hi,

Στις 13/12/2021 10:01 μ.μ., ο/η Bo Berglund via lazarus έγραψε:
> I am constantly using strip -s to reduce the size of the application binary and
> now I wonder if there is a way to make Lazarus NOT include the symbols in the
> first place?
>
> It seems like these are only used when debugging and that is started by clicking
> the green arrow button, so Lazarus should be able to figure out when the symbols
> are needed (for debug) and not add them when not needed...
>
> The reason I have for finding a way to do this is that the binary will be added
> to version control and then it may happen that one forgets the strip -s step
> before committing the state, thus sending an overly bloated binary into
> subversion.

I suppose one way is to use Lazarus's build modes.

i.e.

Add a "release" build mode to your project with the settings you want 
including strip -s support.

Then make a script /batch which builds it using that build mode (i.e.  
lazbuild with --build-mode=<project/ide build mode> or --bm=<project/ide 
build mode> ) and copies the "release" stripped to the relevant location 
( i.e. local repocitory) before commits it .

Or if you don't want a script / batch, I think that you can add the copy 
functionality for that "release" build mode to the "Project Options -> 
Compiler  Options -> Compiler Commands -> Execute after -> Command" and 
leave only the build checkbox checked. With such a configuration, every 
time you build that mode you'll have a stripped "release" binary which 
will be copied to the location after the build ends .

regards,

-- 

Dimitrios Chr. Ioannidis

regards,

-- 

Dimitrios Chr. Ioannidis



More information about the lazarus mailing list