ccache basedir doesn't work as expected

1.6k views Asked by At

I'm trying to make ccache work with the same source code built from different sibling directories. I've successfully set CCACHE_BASEDIR to the parent dir of these two siblings. If I do a build in bld1 and then switch to bld2 and build that copy (again, these are the same sources), I get no cache hits.

I'm now looking at the log output from setting CCACHE_LOGFILE. Unfortunately the log doesn't tell me what factors/data went into computing the hashes it looks up, I just see lots of "No such manifest file" message (for direct lookup, it seems).

Are there any other options I can use to debug the issue with ccache to figure out why it doesn't recognize these two source trees as identical?

Just to be clear, if I repeat the build in a given directory, I do indeed get lots of hits in the cache - so clearly ccache is working with an unchanging build path, it just doesn't seem to be working properly across directories.

1

There are 1 answers

0
Joel Rosdahl On

The solution is most likely to set hash_dir = false (CCACHE_NOHASHDIR=1 if using environment variables) or setting -fdebug-prefix-map=old=new for relocating debug info to a common prefix (e.g. -fdebug-prefix-map=$PWD=.). More details can be found in the "Compiling in different directories" section in the ccache manual.