bazel icon indicating copy to clipboard operation
bazel copied to clipboard

bazel-complete fails due to ccache

Open waarmond opened this issue 1 year ago • 1 comments

Description of the bug:

The bazel-complete.bash step at my 7.1.1 build (Python 3.10, Arch-derivative) fails due to a read-only ccache folder. Disabling !ccache had no effect on the build:

INFO: Analyzed target //scripts:bazel-complete.bash (485 packages loaded, 10582 targets configured).
ERROR: ./bazel/src/src/main/tools/BUILD:3:10: Compiling src/main/tools/daemonize.c [for tool] failed: (Exit 1): gcc failed: error executing CppCompile command (from target //src/main/tools:daemonize) /usr/lib/ccache/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 23 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
ccache: error: Failed to create temporary file for ~/.ccache/tmp/daemonize.stdout: Read-only file system

Next build - strings.cc first: Compiling src/main/cpp/util/strings.cc [..] ccache: error: Failed to create temporary file for ~/.ccache/tmp/strings.stdout: Read-only file system

As far as I know ccache 4.0 has made stored and fetched object files read-only. When I override this with chmod -R 777 it is sadly getting changed back.

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

./compile.sh
./output/bazel build scripts:bazel-complete.bash

Which operating system are you running Bazel on?

ArchLinux

What is the output of bazel info release?

N/A: build issue

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

using bazel-7.1.1-dist.zip

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

waarmond avatar Apr 11 '24 19:04 waarmond

There's nothing in Bazel that uses ccache. My guess is that you have ccache enabled through an environment variable, but it doesn't work because Bazel runs the C compiler in a sandboxed environment, where the location ccache wants to output to isn't writable.

Can you try building with ccache disabled?

tjgq avatar May 14 '24 10:05 tjgq