You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AOSP 8.1编译时ccache设为30GB却始终不超过1GB的技术咨询

Troubleshooting ccache Max Size Not Exceeding 1GB in AOSP 8.1 Docker Build

Let's break down the possible reasons why your ccache isn't growing beyond 1GB despite setting a 30GB limit, and walk through practical fixes for each scenario:

1. Verify ccache Configuration in the Container

First, confirm that your max size setting is actually active inside the Docker container:

  • Enter your running container with docker exec -it <container-name> /bin/bash
  • Run ccache -p and look for the max_size entry. If it shows 1GB instead of 30GB, your configuration isn't taking effect.

Fixes for Configuration Issues:

  • Set the max size directly in the container: Run ccache -M 30G to enforce the limit immediately.
  • Align the config file with your mounted directory: ccache reads config from ~/.ccache/ccache.conf by default. Since you're mounting /home/builder/ccache/, either:
    • Move your ccache.conf into this mounted directory and set the environment variable: export CCACHE_CONFIGPATH=/home/builder/ccache/ccache.conf
    • Add the max size line directly to the config file: echo "max_size = 30G" >> /home/builder/ccache/ccache.conf

2. Check Host Disk Space & Quotas

Even if the container's ccache is set to 30GB, the host system might be limiting the space:

  • On your host machine, run df -h /path/to/your/host/ccache-directory to check available space on the partition where your ccache is mounted. Make sure there's at least 30GB of free space here.
  • Check if disk quotas are enabled for the user owning the host ccache directory: Run quota -u <your-host-username> to see if a quota cap is restricting growth.

3. Confirm AOSP Build Environment Variables

AOSP's build scripts might be overriding your ccache settings:

  • Before starting the build, explicitly set these variables in the container to ensure they take priority:
    export USE_CCACHE=1
    export CCACHE_DIR=/home/builder/ccache/
    export CCACHE_MAXSIZE=30G
    
  • You can also add these lines to the builder user's ~/.bashrc or ~/.profile in the container to make them persistent across sessions.

4. Check Directory Permissions

If the builder user inside the container doesn't have write access to the mounted ccache directory, ccache can't store more cache:

  • In the container, run ls -ld /home/builder/ccache/ to check permissions. The output should show read/write access for the builder user (uid/gid matching the container's user).
  • If permissions are incorrect, fix them on the host: chown -R <host-uid>:<host-gid> /path/to/host/ccache (match the uid/gid of the builder user in the container) or adjust them inside the container with sudo chown -R builder:builder /home/builder/ccache/.

5. Check for ccache Version Bugs

Ubuntu 16.04 ships with ccache 3.2.4, which has known issues with large max size settings in some scenarios. Try upgrading to a newer version:

  • Inside the container, install dependencies first: sudo apt-get install autoconf automake libtool
  • Download and compile the latest stable ccache release (e.g., 4.8.3):
    wget https://github.com/ccache/ccache/releases/download/v4.8.3/ccache-4.8.3.tar.xz
    tar xvf ccache-4.8.3.tar.xz
    cd ccache-4.8.3
    ./configure
    make
    sudo make install
    
  • Verify the new version with ccache --version and re-test your build.

After trying these steps, run watch ccache -s again during your AOSP build—you should see the cache size start growing towards the 30GB limit as more objects are compiled and cached.

内容的提问来源于stack exchange,提问作者Slaviro

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:04:04