[ccache] Automatic fallback from preprocessed to direct mode in case of cache miss

Joel Rosdahl joel at rosdahl.net
Thu Jun 23 15:04:22 MDT 2011


On 2011-06-23 17:15, Rémi Delmas wrote:
> [...]
> Another solution would be for ccache to automatically fallback to
> preprocessed mode in case direct mode fails.

That's precisely what ccache does already (and direct mode is the
default; you don't need to set CCACHE_BASEDIR to activate it). See
http://ccache.samba.org/manual.html#_how_ccache_works for more details.

If I understand your description correctly, your problem has to do with
the -I options being different in the two scenarios, like this:

  Case A:
    cd ~A/dev/ProjectA
    gcc -I../ProjectB -c header.c

  Case B:
    cd ~B/ProjectA
    gcc -I../development/ProjectB -c header.c


The direct mode can't be made to work for this case, so there's nothing
to configure to make it work. The direct mode simply needs to see
exactly the same compiler options (including -I) to kick in, and then it
will search for header files in exactly the same places the previous
compilation found them.

So, I'm afraid you have to encourage or enforce users A and B to use the
same directory layout to benefit from the direct mode (or invent
something more clever).

-- Joel

More information about the ccache mailing list