This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: distributed compilation with gcc: distcc


On 22 Jul 2002, Aldy Hernandez <aldyh@redhat.com> wrote:
> >>>>> "Martin" == Martin Pool <mbp@samba.org> writes:
> 
>  > I've written a small wrapper around gcc that allows the work of
>  > compilation to be distributed across several machines on a network.
> 
>  >   http://distcc.samba.org/
> 
>  > access, a gcc patch, and in general does not require modifications to
>  > your source or Makefiles.  It has a reasonably complete manual and a
> 
> hi martin.
> 
> I've been playing with distcc, and it requires some infrastructure
> work before it can really satisfy our needs.

I haven't built gcc from scratch in years.  I will try it out under
distcc when I get a chance.  In principle, I think it would be
straightforward to make distcc use the new compiler.  I'm looking at
the gcc Makefile in viewcvs now, but it is a bit complex.

> Only a minimal part of gcc is built with the system compiler.  For
> example, once a minimal compiler is built, the rest of the bootstrap
> process uses the new compiler.  

How does that work if you're building a cross-compiler?  (Obviously it
does; I just don't understand.)  Do you build a native minimal gcc
first, and then use it to build the cross?

> So not only do Makefiles have to be tweaked, but distcc has to be
> altered to either handle a path to the new compiler, or be sent the
> entire [new] compiler and assembler as part of the compilation
> request (in case you don't want to use NFS).

distcc will already happily accept a fully-qualified name for the
compiler, as long as the binary can be found under that name on all
systems.  So you can do

  CC="distcc `pwd`/gcc-bootstrapped"

or whatever the name is.  

If the bootstrapped gcc requires some environment variables to be set
to find its libraries that may be more of a problem, since those
variables will not be passed to the daemon.  Ideally they would be set
by command line values instead.  Failing that you could use a shell
script to set them.

Is the intermediate gcc just a single binary, or does it require
libraries and spec files like the real gcc?  If so, copying it across
will be a little more complex.  Is there already something in the
Makefile that knows what all the files are?  (Something like
install-bootstrap?)

Obviously the volunteer machines need to get access to the newly built
compiler.  I can see three ways to do that

 1: have all machines share the build directory over NFS

 2: copy the new compiler onto all machines using rsync, scp, or
    whatever

 3: add a mechanism for copying random files to distcc

I don't know if NFS is practical in the environment of a typical gcc
maintainer.  If it is, then using distcc should be straightforward:
just set CC to give an absolute path to the compiler. 

#2 will require a little bit of distcc-specific Makefile tweaking to
copy the new compiler onto all machines.  (I guess you could keep the
distcc-specific parts out by just having a Make variable run as a hook
before switching compilers; that might be considered more tasteful.)
There are a few details about choosing an appropriate place to put the
new compiler on the remote system.

#3 is possible but it feels a bit like bloat, so I'd rather not do it
unless #1 and #2 are impractical.  Possibly it will be the practical
way to chose the right filenames though.

> I'd be delighted to use distcc for building gcc, if it could handle
> bootstraps.  Hint hint.  ;-)

I would be delighted to have distcc be useful to the gcc maintainers.
distcc wouldn't be nearly as much fun without gcc. :-)

-- 
Martin 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]