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

Bo Berglund bo.berglund at gmail.com
Mon Dec 13 22:29:15 CET 2021

On Mon, 13 Dec 2021 22:34:55 +0200, "Dimitrios Chr. Ioannidis via lazarus"
<lazarus at lists.lazarus-ide.org> wrote:

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

This sounds like what I need.
I looked at the project options and found that there is one box to enter the
Execute after command. And checkboxes to set when it is used.

But I would need *two* commands:
- copy to the svn location
- strip -s on that copy

Does this mean I will have to use a batch file (on Windows) to perform both
How do I then transfer the name of the executable into that command?

And will Lazarus use the standard binary or the one created in the release
folder when debugging?

Bo Berglund
Developer in Sweden

More information about the lazarus mailing list