[ccache] ccache - .d files with absolute system header paths

Karanam Suryanarayana Rao Venkata Krishna venkatakrishna.karanamsuryana at gmail.com
Mon Sep 4 10:12:07 UTC 2017

If I have a file include_stddef.c with just one line
#include <stddef.h>

and compile this file with clang, then, the generated .d file looks like:

include_stddef.o: include_stddef.c \

Even if I use CCACHE_BASEDIR as "/" OR "/absolute/path"
ccache is not rewriting the .d file to contain the relative path,

I'm using version 3.1.9 of ccache.(To be more precise, I'm build Android
8.0, and Android uses the Ninja build system since 7.0. Ninja stores the
dep files into its dependency database, and while doing so, if there is a
.d file fetched from "ccache" cache which contains an absolute path, then,
that path is put into the Ninja dependency database. Thus, chances are the
next build may be `stat'ing the header from another user's workspace, thus,
Ninja's result may not be accurate)

>From just ccache's point of view, is there a way to force relative paths
into the .d files at all? If that can be achieved, then, ninja's problem is
also solved.

I hope I explained myself.

best regards,
PS: I will investigate this myself further. But in the meantime, I thought
I ask the usergroup as well.

More information about the ccache mailing list