size of EXE file lazarus / 6-IDE-CodeTools ---------------------------------------------------------------------- Lacak2 · 2009-02-11 08:46 Hi *, I am sure, that this is common question.  I have also found articles speaking about it (http://wiki.lazarus.freepascal.org/Lazarus_Faq#Why_are_the_generated_ binaries_so_big.3F), but I do not fully understand it. In my very simple example I have one form and one label and button on it. When I compile project, I get 12MB size executable. I have tried some options in Compiler options/Linking, but without effect ... When I use strip.exe on 12MB executable I get 1.5MB executable ... which is fine. Why Lazarus does not use "strip.exe" by default in Building process ? Or is there any switch, which I have missed ? TIA -Laco. ---------------------------------------------------------------------- fonsagrada · 2009-02-11 09:17 You can change the settings of the compiler and the result is the same as if using "Strip.exe". ---------------------------------------------------------------------- Loesje · 2009-02-11 09:18 You can not debug a stripped executable. In most cases the executable size doesn't matter at all. (See this link which is in the faq you mentioned) In some cases it could be an issue when you want to distribute your application. then you can call strip. But that's something you don't do very often, so it can be done manually. Which you also can do is enable all smart-linking options and the strip-symbols options for the compiler. You can find all information on this on the wiki/documentation/faq's etc ---------------------------------------------------------------------- LacaK · 2009-02-11 09:55 Quote from: fonsagrada on February 11, 2009, 10:17:15 amYou can change the settings of the compiler and the result is the same as if using "Strip.exe". Which settings ? When I check "Strip symbols from executable -Xs" on Compiler options/Linking tab ... it has no effect When I check "Link smart -XX" on same tab ... it has no effect ---------------------------------------------------------------------- Legolas · 2009-02-11 10:09 Project->Compiler options->Linking In "Debugging" uncheck all items but "Strip symbols from executable" ---------------------------------------------------------------------- LacaK · 2009-02-11 11:01 Yes, thanks it works now! By default is checked "Display line numbers in Run-time ... (-gl)". So when I checked "Strip symbols from executable -Xs" nothing happens ... but I expected, that stripping happens. So if I understand it correctly, -Xs has no effect if any of other options in Debudding panel is checked ... If it is true ... It would be good if these checkboxes will be mutualy exclusive. (so when I check -Xs then all others will be unchecked or -Xs will take precedence over other switches ?) May be I am wrong ? ---------------------------------------------------------------------- Leledumbo · 2009-02-12 03:03 Quote-Xs has no effect if any of other options in Debudding panel is checkedTry mixing -Xs and -gl on the command line and see the result, I've never done that myself. QuoteIt would be good if these checkboxes will be mutualy exclusive.I agree with this, so the programmers don't mix them and get unexpected result. ---------------------------------------------------------------------- Handoko · 2009-02-12 05:50 There are many ways to make it smaller. Here is my easy step to make it fat loss: - Copy the strip.exe from C:\lazarus\fpc\2.2.2\bin\i386-win32 - Paste it to your project folder - Using Command Prompt, type: strip YourProject.exe - And be happy with the result. Before you strip it off, make sure you are ready to realease it at final build. Because it will strip off the debug information, that means you can not do any debugging later. ---------------------------------------------------------------------- Leledumbo · 2009-02-12 08:11 Quote- Using Command Prompt, type: strip YourProject.exeFor a release, I prefer strip -s (or --strip-all) instead of just strip. Be careful, don't do it to a library or you won't be able to link to it anymore. ---------------------------------------------------------------------- Vincent Snijders · 2009-02-12 08:14 Quote from: Leledumbo on February 12, 2009, 04:03:28 amQuote-Xs has no effect if any of other options in Debudding panel is checkedTry mixing -Xs and -gl on the command line and see the result, I've never done that myself. QuoteIt would be good if these checkboxes will be mutualy exclusive.I agree with this, so the programmers don't mix them and get unexpected result. It makes the chance for bugs in the compiler options handling larger. And if the logic behind the options changes somehow (it doesn't happen often, but it does sometimes), you might not be able to set the options you wish. ---------------------------------------------------------------------- Lacak2 · 2009-02-13 06:50 I can share with you my personal experience ... Before years, when I have used Lazarus first time (I cam to Lazaris from Delphi), I made "small test application", when I have compiled it I got 10MB executable file ... because this was not acceptable for me (comparing to Delphi < 1MB) I have returned back to Delphi. (My conclusion was, that so large size is because of multi-platform character of Lazarus, FPC) After years I returned back to Lazarus, because of need produce application for WinCE ... I make "small test application" ;-) and I get 12MB executable ... so I start searching on web ... What I want to say is, that I am as end-user, developer expecting : FAST & SMALL executable ... and I expect, that default setting in IDE will be set so. Let see at Compiler options/Linking/Debugging : If I uncheck default checked "Display Line Numbers in Run-time Error- backtraces" (so no checkbox is checked in panel Debugging)... size of EXE is about 1.5MB ...  Can not it be a default state after install? If not, then some notice may be post during linking process ? If not, then may it be documented somewhere, that it is possible and how to set up IDE to produce "stripped" exe (without manual using strip.exe)? Please look at this "case" from POV Delphi user, where compiled exe is small. -Laco. ---------------------------------------------------------------------- theo · 2009-02-13 09:43 Quote from: Lacak2 on February 13, 2009, 07:50:57 amCan not it be a default state after install? I wouldn't do that, because then the same people would complain that the debugger doesn't work. But it would indeed be nice to have a Run and a Debug mode. Run would switch off gdb and debug info, while Debug would do what it's doing now in default mode. ---------------------------------------------------------------------- Lacak2 · 2009-02-13 13:37 Quote from: theo on February 13, 2009, 10:43:13 amBut it would indeed be nice to have a Run and a Debug mode. Run would switch off gdb and debug info, while Debug would do what it's doing now in default mode. Or two menu items in Run menu : "Build" "Build with debug" ---------------------------------------------------------------------- Bart · 2009-02-13 14:25 I use the IDE to develop my programs, that means I always want to be able to debug. So I want this by default. Stable, published versions I strip manually. Yes, a 350 K executable (D3) is nice, but hardly anyone I know complains about a 2 M exectable (GUI). Bart ---------------------------------------------------------------------- theo · 2009-02-13 14:37 Quote from: Bart on February 13, 2009, 03:25:31 pm It's not about exe size in my case, but I don't need the debugger for every part of development. Sometimes it crashes for no obvious reason and I use writeln for sending debugging info to the console a lot. The latter is not working when running under gdb. Resp. gdb is not working when I use xterm. So I think having both possibilities at hand without having to switch on and off via settings would be nice. It's not extremely important but it would be nice. ---------------------------------------------------------------------- Paul Ishenin · 2009-02-14 06:11 And I believe you can do it yourself using package. ---------------------------------------------------------------------- Lacak2 · 2009-02-16 06:50 If none of other suggestions is acceptable, what about info in Messages window : Project "..." succesfully build (with debug info). So everybody will be noticed, that some debug is included into EXE. If not acceptable, then please document it somewhere, how to turn off including debug info in Lazarus in Compiler options (may be at http://wiki.lazarus.freepascal.org/Lazarus_Faq#Why_are_the_ generated_binaries_so_big.3F)