如何使Bazel,ccache和沙箱协同工作(ccache只读文件系统) [英] How to get Bazel, ccache, and sandboxing to work together (ccache read only filesystem)

查看:146
本文介绍了如何使Bazel,ccache和沙箱协同工作(ccache只读文件系统)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用通过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?

当我在Ubuntu 18.04上运行相同的命令时,它成功了,所以这使我相信以某种方式支持ccache.

看来,我的问题的一部分是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.

推荐答案

您可以使用

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只读文件系统)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆