How to rebuild stage 1?

Paolo Bonzini paolo.bonzini@lu.unisi.ch
Fri Dec 16 16:05:00 GMT 2005


> I normally work in the "gcc" object directory and keep files there built by
> the system compiler.  That's my starting point.
> 
> Then I do a "make" to build, "make bootstrap" to do a bootstrap, "make
> gnatlib_and_tools" and "make check-ada" to run acats, and then "make
> unstage1" to get back where I started from.
> 
> If I want to run a full build and test, I go up to the top level directory
> and "make" and then "make check".

In your case, I would probably use two build directories, one 
bootstrapped and one not.

mkdir build
cd build
../configure --enable-languages=all --disable-bootstrap
make
cd ..

mkdir build-boot
cd build-boot
../configure --enable-languages=all
make
make check-ada

If you want to build only stage1 in the bootstrapped tree, you can use 
"make all-stage1".  It will fail if you're in the non-bootstrapped tree.

Note that all makes are invoked from the toplevel directory.  Of course, 
you can still do "make" from the gcc directory, but it's not clear that 
you really want to do that (especially with the toplevel libgcc bits 
that are to come).

A debugging session would be like (toplevel bootstrap on the left, old 
on the right):

mkdir build-boot                       mkdir build
cd build-boot                          cd build
../configure                           ../configure
make                                   make bootstrap

(something fails in stage2, and I need to figure out a cc1 invocation 
command line.  To do so, I usually cut and paste the xgcc options into a 
command line with -### added to it.)

cd gcc                                 cd gcc
./xgcc -### foobar                     ./xgcc -### foobar
make all-stage1                        make restage1
cd gcc; gdb --args whatever            gdb --args whatever

 From gdb, I would use "make cc1" as usual to rebuild.

> Can somebody summarize the targets (and directories) equivalent to the above
> in the new scheme?

Maybe we could make a table of use cases like the above, and put it on 
the wiki.  I can fill in the "toplevel bootstrap" case.

Until then, remember that if you're having serious problems (like David 
Edelsohn has) you can use --disable-bootstrap.

Paolo



More information about the Gcc mailing list