bazel: Bazel 7: cannot build protobuf on Linux without --noincompatible_sandbox_hermetic_tmp
Description of the bug:
I cannot build the protobuf repository on Linux anymore with Bazel 7:
/tmp/protobuf main % bazel build :protoc //conformance:conformance_test_runner
INFO: Analyzed 2 targets (165 packages loaded, 2175 targets configured).
ERROR: /tmp/protobuf/src/google/protobuf/BUILD.bazel:194:11: Compiling src/google/protobuf/port.cc failed: (Exit 1): gcc failed: error executing CppCompile command (from target //src/google/protobuf:port_def) /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++14' -MD -MF ... (remaining 22 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
src/google/protobuf/port.cc:12:10: fatal error: google/protobuf/port_def.inc: No such file or directory
12 | #include "google/protobuf/port_def.inc"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.193s, Critical Path: 0.30s
INFO: 239 processes: 233 internal, 6 linux-sandbox.
ERROR: Build did NOT complete successfully
This issue seems to only manifest when using the linux-sandbox strategy. When switching to processwrapper-sandbox, the build works. When adding --noincompatible_sandbox_hermetic_tmp, the build works.
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.
git clone https://github.com/protocolbuffers/protobufcd protobufbazel build :protoc //conformance:conformance_test_runner
Which operating system are you running Bazel on?
Linux
What is the output of bazel info release?
release 7.0.0
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 master; git rev-parse HEAD ?
No response
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
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (10 by maintainers)
@bazel-io fork 7.1.0
Cherry-picked in https://github.com/bazelbuild/bazel/pull/20718. Just FYI @sluongng @lberki
With fb6658c86164b81205a056a9a54975a62f2f957a submitted, I’ll mark this as fixed. Let me know if it still doesn’t work with Bazel after that change!
@bazel-io fork 7.0.1