Re: ccache complains in latest git about -p

From: Christian Trefzer
Date: Sat Mar 25 2006 - 12:32:17 EST


On Sat, Mar 25, 2006 at 03:28:20PM +0100, Andi Kleen wrote:
> With CC="ccache cc" it works as expected.

And here I was, thinking that CC should be a variable containing no
whitespace, ie. just a single path to a binary, be it relative or
absolute, and that there were ways of teaching ccache to be completely
transparent (using gentoo, it was set up for me that way):

$ ls -l /usr/lib/ccache/bin/
insgesamt 0
lrwxrwxrwx 1 root root 15 6. Mär 01:13 c++ -> /usr/bin/ccache
lrwxrwxrwx 1 root root 15 6. Mär 01:13 cc -> /usr/bin/ccache
lrwxrwxrwx 1 root root 15 6. Mär 01:13 g++ -> /usr/bin/ccache
lrwxrwxrwx 1 root root 15 6. Mär 01:13 gcc -> /usr/bin/ccache
lrwxrwxrwx 1 root root 15 6. Mär 01:13 i686-pc-linux-gnu-c++ ->
/usr/bin/ccache
lrwxrwxrwx 1 root root 15 6. Mär 01:13 i686-pc-linux-gnu-g++ ->
/usr/bin/ccache
lrwxrwxrwx 1 root root 15 6. Mär 01:13 i686-pc-linux-gnu-gcc ->
/usr/bin/ccache
$

So all I need to do in order to enable ccache is add this stub dir to
the front of my PATH:

$ echo $PATH
/usr/lib/ccache/bin:/usr/lib/distcc/bin:/usr/local/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.1.0:[...]
(Note: the order of distcc after ccache is important, if not obvious)

So what the thing does is call the next instance of the name it was
called by from your path, ie. subtracts dirname($0) from the beginning
of $PATH, and supply each and every argument to that. In my past setup,
stuff is taken from the cache, and if not found, distributed across
machines. Works extremely well for kernel builds on slow machines, with
a faster one right beside it. And no dirty CC= stuff to begin with : )

AFAICT this is not a religious or purist issues, as there have been real
problems with CC not following the recommendation and some projects
relying on that, but as this thread goes to show there occur problems
even without real problems existing ; ) Maybe setting obscure CC
variables works reliably for kernel builds, I never tried...


Kind regards,

Chris

Attachment: pgp00000.pgp
Description: PGP signature