Control of executable size lazarus / 8-Other ---------------------------------------------------------------------- prunde · 2005-07-23 02:06 I know this has been addressed several times before, but I would really appreciate a definitive answer on dealing with the executable size of a simple project that only contains an empty form and no added code. And please don't tell me to search the forums.  I have done that and followed some of the suggestions.  After downloading Lazarus 0.9.8 and trying different compilation and linking options I always end up with a 9.3MB executable.  After using strip I still end up with a 1.5MB executable. This is unacceptable, even for a debug version. Ideally, exclusively from the IDE, I should be able to choose a release build and end up with a standalone executable of <300K (no upx compression). Allow me to apologize now if I am missing the obvious solutions to achieve the above request.  And thank you for posting those solutions in response to this post. However, if this is not possible, I would appreciate an explanation of the current issues with Lazarus and Free Pascal that prevent the creation of reasonably small executables. Thanx ---------------------------------------------------------------------- kimx · 2005-07-23 08:33 As far as I have understood the problem is not with the compiler, but with the gnu linker, which make the executable have a lot of code which is never being used, somebody please correct me if I'm wrong. ---------------------------------------------------------------------- Marmin_ · 2005-07-24 22:40 True, AFAIK. I'm afraid the size of 1.5 Mb is the minimum size. But, that been said, for larger applications the size grows very slowly. ---------------------------------------------------------------------- grasu · 2005-07-25 09:03 This is how I do: 1. I do not change any compiler settings. 2. After compile, my executable size is 5,675,644 bytes 3. I run strip with:       "C:\lazarus\pp\bin\i386-win32\strip.exe project1.exe" - now thw the size is 1,510,912 4. I compress it with UPX:   "upx project1.exe" - now the size is 426,496 bytes I do not know a better method. I tried setting "Display Line Numbers in Run-time Error Backtraces" in compiler options but the executable gets even bigger - 9 MB Too bad there is not a complete answer to this question in the help, I have seen many messages asking this question on the forum. ---------------------------------------------------------------------- Anonymous · 2005-10-17 22:00 This is the first time I've gotten a 9.5mb hello world executable out of a compiler set to optimize for size and add no debugging info. ---------------------------------------------------------------------- Vincent Snijders · 2005-10-17 22:09 Then you have to look better, the debug info is in there. Even some extra garbage is added by the linker. ---------------------------------------------------------------------- Anonymous · 2005-10-18 14:03 Clearly it disobeys the compile options. I registered for an account here but it never emailed me a password. ---------------------------------------------------------------------- Vincent Snijders · 2005-10-18 14:51 Quote from: "Anonymous"Clearly it disobeys the compile options. Yes, due to a bug in ld, discussed in several other places in this forum. ---------------------------------------------------------------------- Vincent Snijders · 2005-10-18 14:58 Quote from: "Anonymous"I registered for an account here but it never emailed me a password. A possible explanation is, that you email provider blocks mail from miraclec.com, the host of www.lazarus.freepascal.org. ---------------------------------------------------------------------- Marmin_ · 2005-10-19 20:53 Still it is strange that no answer of clarification is given. Or an estimate when this bug is going to be resolved. Also there are huge bugs in the debugger. imo, this executable size problem makes not a good 'advertising' for the Lazarus project, which is too bad. There should be a definite answer as to when approx. this problem will be resolved. For other users, there is also the KOL project (only for windows) which gives executables a lot smaller size. I studied this for a very short time, and as I program solely for Windows XP and coming, I am maybe going to use it; however the system of KOL is entiry different. ---------------------------------------------------------------------- Vincent Snijders · 2005-10-19 21:08 Quote from: "Marmin_"Still it is strange that no answer of clarification is given. Or an estimate when this bug is going to be resolved. Also there are huge bugs in the debugger. What bugs are you talking about (what issue numbers in the bug tracker)? Quoteimo, this executable size problem makes not a good 'advertising' for the Lazarus project, which is too bad. There should be a definite answer as to when approx. this problem will be resolved. If you are talking about the linker bug, so that you have to strip from the command line, it is out of our scope or fpc scopes. If gnu ld isn't fixed by its maintainers, then it will remain an issue until the internal linker is implemented. It is targetted for fpc 2.2, and when that will be? No idea. QuoteFor other users, there is also the KOL project (only for windows) which gives executables a lot smaller size. I studied this for a very short time, and as I program solely for Windows XP and coming, I am maybe going to use it; however the system of KOL is entiry different. Indeed, KOL's main objective is small size, LCL's main objective is portabilty and native look and feel. If you value small size, you should use KOL. ---------------------------------------------------------------------- felipemdc · 2005-10-20 16:58 400kb on Windows after strip and upx isn´t much. 700kb on Linux after strip and upx.