Description of the bug:
On macOS, the treat_warnings_as_errors feature doesn't work because the linker flag is wrong (-fatal-warnings instead of -fatal_warnings).
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.
Create a trivial workspace with BUILD:
cc_binary(
name = "bin",
srcs = ["bin.cc"],
features = ["treat_warnings_as_errors"],
)
and bin.cc:
Then bazel build //:bin will fail on macOS with Bazel 7.
Which operating system are you running Bazel on?
macOS
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.
N/A
What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
I don't think it's a regression
Have you found anything relevant by searching the web?
no
Any other information, logs, or outputs that you want to share?
Output of bazel build --verbose_failures :all:
[...]
ERROR: /private/tmp/warn/BUILD:1:10: Linking bin failed: (Exit 1): cc_wrapper.sh failed: error executing CppLink command (from target //:bin)
[...]
external/bazel_tools~cc_configure_extension~local_config_cc/cc_wrapper.sh @bazel-out/darwin_arm64-fastbuild/bin/bin-2.params
[...]
ld: unknown options: -fatal-warnings
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Target //:bin failed to build
The linker params file contains
-o
bazel-out/darwin_arm64-fastbuild/bin/bin
bazel-out/darwin_arm64-fastbuild/bin/_objs/bin/bin.o
-Wl,-S
-mmacos-version-min=14.2
-no-canonical-prefixes
-fobjc-link-runtime
-headerpad_max_install_names
-lc++
-lm
-Wl,-fatal-warnings
man ld says the correct option would be -fatal_warnings (note the underscore).
Description of the bug:
On macOS, the
treat_warnings_as_errorsfeature doesn't work because the linker flag is wrong (-fatal-warningsinstead of-fatal_warnings).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.
Create a trivial workspace with
BUILD:and
bin.cc:Then
bazel build //:binwill fail on macOS with Bazel 7.Which operating system are you running Bazel on?
macOS
What is the output of
bazel info release?release 7.0.0
If
bazel info releasereturnsdevelopment versionor(@non-git), tell us how you built Bazel.N/A
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD?Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
I don't think it's a regression
Have you found anything relevant by searching the web?
no
Any other information, logs, or outputs that you want to share?
Output of
bazel build --verbose_failures :all:The linker params file contains
man ldsays the correct option would be-fatal_warnings(note the underscore).