Difference between revisions of "Compile without debug information"

From Lazarus wiki
Jump to navigationJump to search
Line 28: Line 28:
 
A-3, from forum user ''Soner'':
 
A-3, from forum user ''Soner'':
  
You can also create external debug file, then you have debug infos if you need it and small application file. Look at the picture, screenshot is from "Menu > Project > Project Options".
+
You can also create external debug file, then you have debug infos if you need it and small application file. Look at the picture, screenshot is from IDE menu "Project > Project Options".
 +
 
  
 
[[File:ide_external_debug_info.jpg]]
 
[[File:ide_external_debug_info.jpg]]

Revision as of 08:48, 26 April 2022

Q: I can't find the option to compile without debug information. How can I compile without debug information?


A-1, from forum user howardpc:

User "Project -> Project Options...". In the "Options for Project: xxx" dialog click the "Debugging" node under "Compiler Options" in the tree-view on the left. Then uncheck the "Generate info for the debugger (slower / increases exe-size)" checkbox.


A-2, from forum user Martin_fr:

This affects only your project. If packages (LCL or other) are compiled with debug info, then that does not change => each package has it's own setting. And many package also mix in the "Configure build IDE" options.

You can use "Additions and Overrides" in the "Project Options" to make changes. This also allows to re-compile packages with more/less optimization and/or with/without range/stack/overflow-checks etc.

Note: The RTL (and FCL) are pre-build. The installers that come with Lazarus usually does install them without debug info. The IDE has no method to rebuild them. To change those (well you do likely not need, since they should match your requirements) you would need to rebuild them from the command line. See buildfaq.

Some function names may be left in the exe, even if debug info is switched off (IIRC that happens while linking, but not sure) => just use "strip.exe" on the your compiled exe.

On top of that, note that your app always carries RTTI (well almost always...). So if you use a hex viewer you will still find some names from your source code. But that is not debug info.


A-3, from forum user Soner:

You can also create external debug file, then you have debug infos if you need it and small application file. Look at the picture, screenshot is from IDE menu "Project > Project Options".


ide external debug info.jpg