[ccache] preprocessor mode

Yoav Alon yoava333 at gmail.com
Thu May 12 19:24:02 UTC 2016

Hi ccache,
I'm trying to use ccache with preprocessor mode (direct_mode=false) and I'm
unable to get cache hits.
I have the following hierarchy:

main.c conatins:
#include <stdio.h>
#include <a.h>
int main() {
  printf("%s\n", __A__);

includes1/a.h and includes2/a.h are identical and contain just:
#define __A__ "ccache"

My compilation command is:

ccache gcc -c main.c -o main.o -Iincludes1

ccache gcc -c main.c -o main.o -Iincludes2

And the result is two cache misses (and two new files in cache). And I
don't understand why.

this is my configuration:

(default) base_dir =

(default) cache_dir = /Users/yoavalon/.ccache

(default) cache_dir_levels = 2

(default) compiler =

(default) compiler_check = mtime

(default) compression = false

(default) compression_level = 6

(default) cpp_extension =

(/Users/yoavalon/.ccache/ccache.conf) direct_mode = false

(default) disable = false

(default) extra_files_to_hash =

(default) hard_link = false

(default) hash_dir = false

(/Users/yoavalon/.ccache/ccache.conf) log_file = /tmp/ccache_log

(default) max_files = 0

(/Users/yoavalon/.ccache/ccache.conf) max_size = 5.0G

(default) path =

(default) prefix_command =

(default) read_only = false

(default) read_only_direct = false

(default) recache = false

(default) run_second_cpp = false

(default) sloppiness =

(default) stats = true

(default) temporary_dir =

(default) umask =

(default) unify = false

The reason I'm seeking a cache hit when the include directory is changed is
that our CI system always increments the version on each build for each
dependency, thus changing the include directory for that build. reading the
documentation I thought preprocessor mode will help me but it doesn't seem
to work. Am i missing something?



More information about the ccache mailing list