2

I'm compiling AOSP 8.1.0 source tree on my build server. I made a docker image with all packages needed from Ubuntu 16.04. I mount the source tree, ANDROID_OUT and ccache dir when starting docker image. The path in docker for these three directories is the same:

Sources: /home/builder/android_source/AOSP_8.1/

Out: /home/builder/android_out/AOSP_8.1/

ccache: /home/builder/ccache/

The question is that I don't understand how ccache behaves. If I'm running watch ccache -s while compiling android, I see something like:

files in cache: 10365
cache size: 931.9MB

And some seconds after these values can either increase or decrease. I've set max cache size to 30GB, ccache -s tells me this correct max size, but cache size never comes over 1Gb. The maximum size I've seen after 5 builds run after each other is about 983MB.

What I tried?

1) chown -R builder:builder ~/ccache/

2) ccache -M 30G in docker. Max sized sets to 30GB, behavior remains the same.

3) ccache -C - cache clears, nothing gets better.

What is wrong with my ccache?

2 Answers 2

5

For some strange reason this situation was due to some incompatibility between system ccache and android ccache. After doing

ccache -M 50G

with ccache utility from android sources directory everything is working.

5

If anyone is still interested the answer is this:

Android:
prebuilts/misc/linux-x86/ccache/ccache -M 50GB stores 50GB as 50*65536 in your /0 to f/stats in line 15.

Gnu:
/usr/bin/ccache tool keeps as stated in the manual in your: /ccache.conf (typically /etc/ccache.conf or /usr/local/etc/ccache.conf ) or /ccache.conf (typically $HOME/.ccache/ccache.conf) as human english text: max_size = 50GB

So each tool keeps it in diferent place. But the android one doesn't have a manual.

2
  • What does /0 to f/stats in line 15 mean? Dec 18, 2020 at 22:15
  • /0 to f/stats in line 15 means that in the CCACHE_DIR there are directories 0/..f/. Each has a stats file that keeps statistics and the max_size and max_files configuration. max_size is line 15 of the stats file and max_files is line 14. This applies to ccache 3.1.9 - I'm not sure if it applies to all other versions. The AOSP build uses the ccache binary in ./prebuilts/misc/linux-x86/ccache. The source for that prebuilt is in a tarball there as well. Dec 18, 2020 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.