Describe the bug
Compile warnings on macOS. Breaks build of BoringSSL because that one uses -Werror in its own cxxopts.
System
Which OS, compiler, and compiler version are you using:
- OS: macOS 26.5.2
- Compiler and version: Apple clang version 21.0.0 (clang-2100.1.1.101); Target: arm64-apple-darwin25.5.0; Thread model: posix
To reproduce
Steps to reproduce the behavior:
- sync to commit
8b66b54f7e1bf6b25390dca1dea3f18a40e607f9
bazel build --cxxopt=-Werror :all (or even just bazel build :all)
- See error (or multiple screen pages of warning spam)
Actual behavior
INFO: Analyzed 3 targets (0 packages loaded, 627 targets configured).
ERROR: /private/tmp/benchmark/BUILD.bazel:41:11: Compiling src/benchmark_runner.cc failed: (Exit 1): cc_wrapper.sh failed: error executing CppCompile command (from target //:benchmark) external/rules_cc++cc_configure_extension+local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object ... (remaining 43 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from src/benchmark_runner.cc:15:
In file included from src/benchmark_runner.h:23:
In file included from src/perf_counters.h:30:
src/mutex.h:79:40: error: mutex 'mut_' is still held at the end of function [-Werror,-Wthread-safety-analysis]
79 | void lock() ACQUIRE() { mut_.lock(); }
| ^
src/mutex.h:79:32: note: mutex acquired here
79 | void lock() ACQUIRE() { mut_.lock(); }
| ^
src/mutex.h:80:34: error: releasing mutex 'mut_' that was not held [-Werror,-Wthread-safety-analysis]
80 | void unlock() RELEASE() { mut_.unlock(); }
| ^
2 errors generated.
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.202s, Critical Path: 1.00s
INFO: 14 processes: 1 action cache hit, 9 internal, 5 darwin-sandbox.
ERROR: Build did NOT complete successfully
Expected behavior
A working build.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Can workaround by also passing --cxxopt=-DHAVE_THREAD_SAFETY_ATTRIBUTES=1. Suggest adding this to your BUILD.bazel. Does Bazel even work with any compilers that don't support thread safety attributes?
Our workaround: https://boringssl-review.googlesource.com/c/boringssl/+/99447
Describe the bug
Compile warnings on macOS. Breaks build of BoringSSL because that one uses
-Werrorin its owncxxopts.System
Which OS, compiler, and compiler version are you using:
To reproduce
Steps to reproduce the behavior:
8b66b54f7e1bf6b25390dca1dea3f18a40e607f9bazel build --cxxopt=-Werror :all(or even justbazel build :all)Actual behavior
Expected behavior
A working build.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Can workaround by also passing
--cxxopt=-DHAVE_THREAD_SAFETY_ATTRIBUTES=1. Suggest adding this to yourBUILD.bazel. Does Bazel even work with any compilers that don't support thread safety attributes?Our workaround: https://boringssl-review.googlesource.com/c/boringssl/+/99447