[ccache] Header-file paths in external build directories

Joel Rosdahl joel at rosdahl.net
Mon Nov 19 21:20:44 UTC 2018

On Fri, 16 Nov 2018 at 19:46, Nico Huber via ccache
<ccache at lists.samba.org> wrote:
> [...]
> If I'm looking at the right spot in the code, I can see that 1. happens
> on purpose (in process_preprocessed_file(), ccache.c:945). Though, I
> wonder why?

The history of that code is that https://github.com/ccache/ccache/pull/88
removed it to implement a new feature in ccache 3.3: "Names of included files
are no longer included in the hash of the compiler's preprocessed output. This
leads to more potential cache hits when not using the direct mode." Then
https://github.com/ccache/ccache/issues/134 was discovered, leading to a revert
in https://github.com/ccache/ccache/commit/7cad4ac5.

> Could this be handled with the `base_dir` normalization? I already tried to set
> $(obj) as base_dir, without success. I guess it would require to normalize paths
> relative to `base_dir` even if they are not under `base_dir`.

base_dir should be set to a parent directory of all paths seen by ccache. How
is $(obj) related to your source code directory? Are both absolute paths? Can
$(obj) be reached by a relative path that is the same for different
compilations for which you expect cache hits?

-- Joel

More information about the ccache mailing list