问题描述
我正在尝试使用通过copr安装的Bazel 0.16.1和通过DNF安装的ccache 3.4.2在Fedora 28上构建C ++应用程序.我正在使用默认的cc_binary和cc_library规则.当我运行bazel build命令时,出现ccache错误并显示为:
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
当我使用-verbose_failures --sandbox_debug
进行构建时,可以看到我们没有安装ccache tmp目录r/w.
I can see when I build with --verbose_failures --sandbox_debug
that we're not mounting the ccache tmp directory r/w.
那么,如何让bazel挂载我的ccache目录r/w,或者如何通过bazel告诉ccache我的工作区正确的缓存目录在哪里?
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?
看来,我的问题的一部分是ccache将其编译器驱动程序安装为gcc.例如.哪个gcc->/usr/lib64/ccache/gcc
.在Ubuntu上的哪个位置必须显式调用ccache,默认工具链不会调用它.
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.
推荐答案
您可以使用 -sandbox_writable_path =< path>
[1].
You can add existing directories to the sandbox with --sandbox_writable_path=<path>
[1].
[1] https://docs.bazel.build/版本/master/command-line-reference.html
这篇关于如何使Bazel,ccache和沙箱协同工作(ccache只读文件系统)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!