Search code examples
androidccache

ccache fails with read only


im building android 10 on an ubuntu machine. the source is custom and not googles' specifically. the source is hard-coded for a prebuilt clang to use ccache. i have installed ccache and added to bashrc these variables:

_CCACHE_EXEC=/usr/bin/ccache

_CCACHE_EXEC -M 50G

export USE_CCACHE=1

chmod and chown the ~/.ccache has the same results during the build, the actual error is:

ccache: error: Failed to create directory /home/brandonabandon/.ccache/tmp: Read -only file system.

i cannot contact the owner of the source. i have attempted disabling ccache which leads to errors further on due to recent hard-coded ccache commits. i could build fine before. ive been stumped for a week. any ideas?


Solution

  • It looks that you have your ccache on the same partition as your source code. soong sandboxing mechanism does not like it:( you have two options:

    1. start to use another partition/drive for ccache
    2. mount your current ccache to another partition (/mnt for example)

    Here is a list of steps for the second option:

    sudo mkdir /mnt/ccache
    sudo mount --bind /home/<your_current_path>/ccache /mnt/ccache
    

    and needed env:

    export USE_CCACHE=1
    export CCACHE_EXEC=/usr/bin/ccache
    export CCACHE_DIR=/mnt/ccache
    ccache -M 100G -F 0