Recent

Author Topic: Howto: Not to include debug info in your final build ...  (Read 11238 times)

Patriot

  • New member
  • *
  • Posts: 8
Howto: Not to include debug info in your final build ...
« on: January 03, 2008, 09:38:41 am »
Hello comrades !

I was going through fpc switches & options the other day and I noticed that normal fpc compile without debug info works as intended ..... so ... I was wondering why do I have to use strip to remove them from my final Lazarus builds ...

So, I went through Lazarus project options and tested compiler options looking for this 'behaviour' on a simple empty Lazarus form application. It seems that if any of the debug switches are selected under the Linking tab then the binary size will be monstrous (with the exception of -Xs which doesn't seem to affect the size).

I compiled an empty form application with each switch turned on individually. With Lazarus 0924beta win32, the final binary size will be 11.2MB (no matter which debug options is selected or even if all is selected) ... Phew ...

If all the options is turned off, the final binary size will be 1.08MB ... 10MB for debug info ? Wowzer ...

Now I can skip stripping my final builds ... For those of you who wishes to confirm this :

1. Goto Project -> Compiler Options -> Linking
2. Turn off all debug info options. (Normally -gl is selected as default)
3. Build your binary
4. Check binary app  size
5. (Optional) Decide whether you want to upx

Rgds

duncanparsons

  • Jr. Member
  • **
  • Posts: 83
RE: Howto: Not to include debug info in your final build ...
« Reply #1 on: January 03, 2008, 11:48:16 am »
thx for that! handy info ;)

DSP

Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
RE: Howto: Not to include debug info in your final build ...
« Reply #2 on: January 07, 2008, 09:47:18 am »
That's what I've done in years. As additional info: Use the Load/Save button to save it as a file, so you won't need to do things up there again and again. Just load it out!

Patriot

  • New member
  • *
  • Posts: 8
RE: Howto: Not to include debug info in your final build ...
« Reply #3 on: January 07, 2008, 09:40:57 pm »
Hmmm .....

In "trying" to be a good lazarus citizen, I've read through the wiki sections including the one here :
http://wiki.lazarus.freepascal.org/File_size_and_smartlinking

And search/read the forums for more info on final binary sizes. All were about stripping and upx'ing (which is not my idea of tiny binary sizes) ... I haven't encountered one that points out this particular compile/link setting (perhaps I haven't looked hard enough or maybe I'm missing the finer prints somewhere).

I've only recently started making the conversions of my dev stuff to fpc/lazarus and "minor" issues like compiled sizes is not sufficiently documented (I meant default settings that can have an impact on compiled binary). If info on minor stuff like this are readily available with proper references (and properly highlighted) then we won't have many new shocked users (me included then) asking the same stuff over and over again now would we ?

Well, I've already made those changes permanent to my lazarus rebuilds and currently still fooling around with lazarus stuff .....

Rgds

 

TinyPortal © 2005-2018