Disabling debug when building gcc

Jeffrey Walton noloader@gmail.com
Mon Jul 25 15:38:00 GMT 2011


On Mon, Jul 25, 2011 at 4:08 AM, lol37 lol37 <lol37cs16@gmail.com> wrote:
> Hello all,
> How to disable completely -g flag when building gcc, i passed
> CFLAGS="-O2" and edited Makefile but all subdirectory ( libgcc,
> libstdc++v3, libgomp ... ) still uses the -g flags and i cannot edit
> their Makefile, they are creating while building ( configure )
> Can someone help me, it will be grateful.
I'm not familiar with automake and friends, so I can't help you with
pulling flags out.

According to the GCC folks, there is no penalty incurred with debug
symbols. See "How does the gcc -g option affect performance?",
http://gcc.gnu.org/ml/gcc-help/2005-03/msg00032.html.

You can remove symbols after the fact with `strip`:

  > ls -l myprogram
    ... 6866924 2009-04-28 16:12 myprogram
  > strip --strip-debug myprogram
  > ls -l myprogram
    ... 1738761 2009-04-28 16:13 myprogram

Jeff



More information about the Gcc-help mailing list