I am building a large Bazel project in a cloud VM with /tmp
in a small filesystem (~8 GB). Occasionally my build fails with the error Not all outputs were created
: the filesystem containing /tmp
is at 99% of capacity, and /tmp
contains many Bazel build artifacts.
How can I override the temporary directory that Bazel uses? I tried setting the TEMP
and TMPDIR
environment variables when starting bazel build
, but this did not help.
You can set --output_base
to put all output in a non-default directory:
bazel --output_base=/dir/with/more/free/space build //foo
However, I don't think Bazel will use /tmp
(by default) after you've installed it (the installer does use /tmp), so perhaps you're hitting a different problem.
If you are using the configure_make rule from rules_foreign_cc , unfortunately you have no way to influence where the built deps are stored.
See https://github.com/bazelbuild/rules_foreign_cc/blob/master/cc_configure_make/def.bzl#L44
"tmpdir=$(mktemp -d)",
"tmpinstalldir=$(mktemp -d)",
I think you want the --test_tmpdir=<a_path> command line argument to the bazel
command.
--test_tmpdir=<a path> default: see description
Specifies the base temporary directory for 'bazel test' to use.
您还可以参考 Bazel 的手册,描述输出目录布局
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.