[ccache] dependency information not updated correctly

bruce robertson bruce.e.robertson at intel.com
Fri Jul 20 16:56:04 MDT 2012

The context of my problem is building Android.

I have two trees I do builds in. Part of the compile line has an "-MD -MF
for instance, to create the dependency file for the compilation.

Quoting from the ccache-3.7 MANUAL.txt,
How ccache works
...                                            On a cache hit, ccache is able
to supply all of the correct compiler outputs (including all warnings,
dependency file, etc) from the cache.

So say initially the ccache is clean (easily caused by ccache -C). I
build totally in tree number 1. Now many dependency files will have full
pathnames of the compilers stddef.h, float.h, stdarg.h etc. files. E.g.,

Perhaps there's a way to make these not be a full pathname?

Now if I go to tree number 2, re-source envsetup.sh, lunch <mytgt>, do
another full make. ccache will supply objects and dependency files to
help the process. Good. Everything is fine. Sort of. The dependency
files fetched from ccache refer to a tree 1's compiler's system files
rather than the tree I'm using.

Now I decide I'm done with tree number 1, I delete or just rename it. If
I now do a make in tree number 2, all objects that refer to the
"missing" compiler include files will be rebuilt as I suppose ccache
assumes I have done something consistent like renaming some underlying
dependency. <SPECULATION> But as all the files actually when compiled or
preprocessed have the same signatures there is now a cache hit and the
cache provides the dependency file and object. And the dependency file
has not been changed </SPECULATION>, so we will do the same thing next

It's distracting to see all these "builds" happening when I haven't
changed my tree at all. And it takes a couple more minutes.


More information about the ccache mailing list