[distcc] Re: Using cc1/cc1plus directly from distccd?

Stuart D. Gathman stuart at bmsi.com
Sat Mar 1 18:26:40 GMT 2003

On Wed, 26 Feb 2003, Martin Pool wrote:

> On 18 Feb 2003, "Stuart D. Gathman" <stuart at bmsi.com> wrote:
> > My old cc1.c code support the -pipe option to gcc.  This results in ccp 
> > feeding directly to cc1 over the network (without a temporary file) and the 
> > output of cc1 feeding directly to 'as'.
> I suppose distcc could assemble locally by passing -S to the remote
> compiler, and then running as on the results.
> If there is a clear case where this is faster or easier I'd accept a
> patch for it.

Faster: no, using -S through gcc does not support -pipe, and must collect
all preprocessed source before beginning compile, and collect all
preprocessed assmbler source before running assembler.  Since the
assembler is relatively fast, the extra collect and copy step might
even slow things down.

Easier: yes, in my case there is no open source assembler with IBM syntax
for PPC, and I'd rather not have to retarget gcc to GNU syntax on AIX
(especially since not all AIX PPC features are available through gas).

Ideally, there should be a way to hook the compiler pass through distcc.  
I realize this is tricky.  Here is my best idea so far:

  - gcc supports a -B option which specifies a directory to look in first for
  	tools such as cpp, gas, ld, cc1, cc1plus, collect, etc.

  - distcc creates its own tool directory with symlinks to the default
  	tool directory for all tools it doesn't know about, and uses -B
	to tell gcc to this new tool directory.  (If the user uses -B,
	distcc doesn't use this strategy.)

  - distcc knows about compiler passes such as cc1,cc1plus,jc1.  It replaces
  	those with a stub in its tool directory.  The stub uses the distcc
	protocol to convey preprocessed source and assmbler output
	to and from the volunteer system.

  - the distcc protocol is extended to support piped file descriptors
  	like rsh and ssh do.  distcc uses this extension to meaningfully
	support the -pipe option.  I would suggest simply using rsh/ssh,
	but those don't report the program completion code, and working
	around that is ugly.

			Stuart D. Gathman <stuart at bmsi.com>
      Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
	"[Microsoft] products are even less buggy than others, in terms of
	    per capita usage." - Steve Balmer, Microsoft Corporation

More information about the distcc mailing list