I'm attempting to build a C++ application on Fedora 28 using Bazel 0.16.1 installed via copr and ccache 3.4.2 installed via DNF. I'm using the default cc_binary and cc_library rules. When I run the bazel build command, ccache errors out with:
ccache: error: Failed to create temporary file for /home/mwalker/.ccache/tmp/time.stdout: Read-only file system
I can see when I build with --verbose_failures --sandbox_debug
that we're not mounting the ccache tmp directory r/w.
So, how do I get bazel to mount my ccache directory r/w, or how do I tell ccache through bazel where the correct cache directory for my workspace resides?
When I run the same command on Ubuntu 18.04 it succeeds, so this leads me to believe that ccache is supported in some way.
It looks like part of my problem is that ccache installed its compiler driver as gcc. E.g. which gcc -> /usr/lib64/ccache/gcc
. Where on Ubuntu ccache must be explicitly invoked, and the default toolchain is not calling it.
You can add existing directories to the sandbox with
--sandbox_writable_path=<path>
[1].[1] https://docs.bazel.build/versions/master/command-line-reference.html