I would like to understand the reason behind recent ccache
misses and find a way fix this problem.
For a while, I have been successfully using clang
and ccache
. Recently (probably after an update from clang 14 to 18), I started seeing a lot of ccache
misses.
Taking a closer look, I noticed that the preprocessor outputs “stripped” header paths in addition to “regular” ones which then trips ccache
. Below is an example where ccache
reports an inode cache hit for an absolute path to a Boost header file and then immediately after that, a cache miss to a “stripped” version of that path.
[2024-09-06T11:12:27.501651 561044] Inode cache hit: /nix/store/l1l8b1mgnzllsngr7158p9j5vz2qa4sm-boost-1.81.0-dev/include/boost/container_hash/hash.hpp
[2024-09-06T11:12:27.501671 561044] Failed to lstat include/boost/container_hash/hash.hpp: No such file or directory
This seems to only happen with boost-related include paths. Additionally, it might be important that I run this whole setup under nix develop
– all libraries, headers, and ccache
and clang
themselves, come from a Nix store.
My current hypothesis is that those “stripped” (relative) paths should not be emitted by Clang’s preprocessor at all or that I’m doing something wrong and in effect I’m causing Clang to emit those relative paths.