Mat
Mat

Reputation: 1500

How to avoid 'No space left' on Bazel build?

Running a lengthy Bazel build on a near-full device, I encounter this error:

ERROR: I/O error while writing action log: No space left on device

However, I can't quite free up some space on the device, so I must manipulate the cache and/or the temporary storage somehow. I've noticed that Bazel's cache at ~/.cache/bazel/myproject/ can get pretty big, so I was wondering, can I:

Bazel's User Manual seems to indicate that the --[no]use_action_cache would kind of do that third option (though I don't know how efficient that would be), but it would slow things down.

As for the temporary storage, I do have a location with enough space, so I simply called export TMPDIR=/path/to/morespace/. So if I could move the cache, that would be where it's going.

Upvotes: 1

Views: 9555

Answers (1)

Jin
Jin

Reputation: 13493

You can use the startup option --output_base to point to a location where there's more available storage. This will tell Bazel where to write all its outputs.

$ bazel --output_base=/path/to/more/space build ...

To avoid specifying this for every command, add it to your project <project>/.bazelrc or user ~/.bazelrc:

startup --output_base=/path/to/more/space

Upvotes: 3

Related Questions