This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: building gcc
On Thu, Oct 12, 2006 at 06:56:58AM -0400, Bob Rossi wrote:
> On Thu, Oct 12, 2006 at 09:48:13AM +0200, Paolo Bonzini wrote:
> >
> > >In particular, I was just wondering how do compile GCC with debug. Not
> > >how to debug it. I tried CFLAGS="-g" ./configure ..., but it still
> > >compiled with gcc -O2 -g. Anyways, if anyone knows a helpful configure
> > >trick that will help get me ready to debug gcc, please let me know.
> >
> > By default, GCC bootstraps itself, and after the first stage it always
> > compiles itself with optimization enabled. So what you need is
> >
> > ./configure --enable-languages=c,c++ --disable-bootstrap
> > make CFLAGS=-g
> >
> > (or equivalently, with CFLAGS=-g passed to configure).
>
> Thanks Paolo,
>
> Here's what I have so far.
>
> ../gcc/configure CFLAGS="-g" --enable-languages=c,c++ --enable-checking
> --disable-bootstrap --prefix=$PWD/../prefixdir
Actually, the CFLAGS="-g" caused a problem. OK, now, as I expected,
I configure with
../gcc/configure --enable-languages=c,c++ --enable-checking
--disable-bootstrap --prefix=$PWD/../prefixdir
and the gcc that is put into prefixdir is compiled with -O2 and -g,
which makes it hard to follow in the debugger. Anyone have a clue on how
to compile gcc so only -g is used, and not -O2? Typically, I use the
CFLAGS trick, but it doesn't seem to work for gcc.
Thanks, and sorry for all the noise.
Bob Rossi