[distcc] Re: gcc: installation problem, cannot exec `as'

Dimitri PAPADOPOULOS-ORFANOS papadopo at shfj.DECOY.cea.NOSPAM.fr
Tue May 13 16:11:48 GMT 2003


Hi,

> > The default PATH for root is:
> > /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin/X11:/usr/X11R6/bin:/root/bin
> 
> This can't be the PATH that was set when distccd was started, though.


> It was probably something like this:
> 
>     /bin:/usr/bin:/usr/local/bin:/usr/bin/X11:/usr/X11R6/bin

Ah indeed, when distccd is started the PATH is:

/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin


> > and for some reason most of the path is discarded.
> 
> Distccd (the daemon) assumes that you don't wish to call ccache for
> compiling things (since it assumes that you want to use ccache before
> distcc), so it trims the path to remove everything up through the ccache
> masquerade dir it finds.  If you do really want to use ccache, you can

Indeed I don't wish distccd to call ccache. As you suggest it's ccache 
that calls distcc.


> override this by setting the DISTCCD_PATH environment variable before
> starting distccd.
> 
> One thing that baffles me in your setup is where the real compiler
> exists on the PATH.  Since gcc is a symlink to ccache in /usr/local/bin,
> there does not appear to be a directory after that on the PATH that
> should contain the real gcc executable.  How does ccache know what
> compiler to run?

The real compiler is:
	/usr/bin/gcc
	/usr/bin/cc
	/usr/bin/g++
	/usr/bin/c++

The PATH seen by root at startup is:
	/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
but on the other hand distcc is started this way:
	daemon --user nobody /usr/local/bin/distccd --daemon
so maybe the daemon command could be modifying the PATH?

The typical PATH for distcc users is:
	/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin


The "client" setup is described below:
* We rely on /usr/local/bin being first in the PATH so that the symlinks
   to gcc and g++ are used instead of the real compiler:
   	$ which gcc g++
   	/usr/local/bin/gcc
   	/usr/local/bin/g++
   	$
   	$ file /usr/local/bin/gcc /usr/local/bin/g++
   	/usr/local/bin/gcc: symbolic link to ccache
   	/usr/local/bin/g++: symbolic link to ccache
	$
* So in effect when we call gcc or g++ /usr/local/bin/ccache is
   called instead, through gcc or g++ symlinks.
* The environment variable CCACHE_PREFIX is set:
   	$ echo $CCACHE_PREFIX
   	distcc
   	$
* This means that ccache will modify each call to gcc or g++:
   	gcc -> distcc gcc
   	g++ -> distcc g++
* Then ccache should call distcc which will contact distccd on a
   distant machine.
* ccache never calls the real compiler directly.


The "daemon" setup is described below:
* The PATH of root when distccd is started is:
   	/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
   so unless the daemon command modifies the PATH distcc cannot see
   ccache, the symlinks to ccache, or the distcc client which all live
   in /usr/local/bin.
* Somehow this PATH seems to be changed upon startup into:
   	/usr/bin/X11:/usr/X11R6/bin
   How is that possible?


Any clue?


Regards,
--
Dimitri




More information about the distcc mailing list