[distcc] Re: implicit compiler name

Martin Pool mbp at samba.org
Fri Sep 20 05:50:00 GMT 2002


On 20 Sep 2002, Alexandre Oliva <oliva at lsd.ic.unicamp.br> wrote:
> On Sep 20, 2002, Martin Pool <mbp at samba.org> wrote:
> 
> > So checking symlinks to find out which is the real compiler may be a
> > bit hard.  
> 
> Besides, consider what if ccache decided to take the same policy: all
> of a sudden, it would stop finding distcc (if it's a gcc->distcc link)
> and going straight to gcc (assuming that's not also a symlink in say
> ~/bin).
> 
> IMHO the right way to do it is to search for argv[0] in the PATH, drop
> everything you find until you encounter yourself, and start searching
> for another occurrence of argv[0] starting from there.  The tricky
> part is to tell when you've encountered yourself, though.

That sounds pretty good, but...

Consider

  PATH=/usr/bin:/bin:/usr/local/bin:/sbin

  /usr/local/bin/distcc
  /usr/bin/cc

  distcc -c hello.c

So we need to somehow work out whether we're meant to look for another
compiler with the same name (e.g. ln -s distcc cc; cc -c hello.c), or
whether we're meant to call "cc" or $DISTCC_CC (e.g. "distcc -c
hello.c").  

That decision might be based on whether argv[0] looks like "distcc",
or perhaps on whether any other compiler can be found on the path.

All this also has to be done on the command line passed remotely.

I suppose we could drop "distcc -c hello.c", but I kind of like it as
a tradeoff between brevity and clarity.  I'm finding that for many
free packages it works pretty well.

-- 
Martin 



More information about the distcc mailing list