# Compiling kernel with ccache: no cache hits or speedup

## lambda_tango

Hey all. So I've got a weird problem that I haven't found a solution to with Google or the forum search. Using vanilla-sources, so this is being put in Unsupported Software.

Anyway, so I've managed to get the kernel to at least compile with ccache. With no size or file limits on the cache, I run

```
make clean && ccache -C && ccache -z

time make -j4
```

The results:

```
make -j4  1490.43s user 63.54s system 299% cpu 8:39.69 total

cache directory                     /root/.ccache

cache hit (direct)                     0

cache hit (preprocessed)               0

cache miss                          2078

called for link                       23

called for preprocessing              13

unsupported source language           60

no input file                        183

files in cache                      6234

cache size                          93.3 Mbytes
```

Now I run

```
make clean && ccache -z

time make -j4
```

And the results are:

```
make -j4  1460.19s user 62.76s system 309% cpu 8:12.62 total

cache directory                     /root/.ccache

cache hit (direct)                    34

cache hit (preprocessed)               2

cache miss                          2042

called for link                       23

called for preprocessing              13

unsupported source language           60

no input file                        183

files in cache                     12359

cache size                         185.3 Mbytes
```

Admittedly I was browsing the web and loading images and YouTube while this was happening, so time's results might be off. But even still, it seems like a lot of stuff is being compiled and cached only once, and somehow rendered invalid for the next compile. Thus rendering ccache mostly useless for kernel compilation.

I know I've seen several articles and guides talk about using ccache with the kernel and not having to do anything special. So I don't think I'm missing anything.

Any ideas as to why ccache doesn't seem to be doing what it's supposed to?

----------

## desultory

 *lambda_tango wrote:*   

> Hey all. So I've got a weird problem that I haven't found a solution to with Google or the forum search. Using vanilla-sources, so this is being put in Unsupported Software.

 Moved from Unsupported Software to Kernel & Hardware, vanilla-sources is still supported, it just it not currently planned for stabilization due to the number of upstream releases. 

As for the ccache behavior, it would appear to be due to kernel version tracking, as implied by the first field in the output of uname -v.

----------

