Skip to content

exec builds fail with cl : Command line error D8043 : unknown option '-g0' with MSVC and /options:strict #24545

@carpenterjc

Description

@carpenterjc

Description of the bug:

We use /options:strict with MSVC as part of our minimum quality bar. As part of the bazel 8.0 upgrade everything it now fails to build any tool for exec.

example error:

ERROR: D:/bazel_bugs/strict_error/BUILD.bazel:2:10: Compiling tool.cpp [for tool] failed: (Exit 2): cl.exe failed: error executing CppCompile command (from target //:tool) C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\cl.exe @bazel-out/x64_windows-opt-exec-ST-d57f47055a04/bin/_objs/tool/tool.obj.params
cl : Command line error D8043 : unknown option '-g0'
cl : Command line error D8043 : unknown option '-g0'

Which category does this issue belong to?

C++ Rules, Starlark Integration

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

With the following example
strict_error2.zip
run:

bazel build //... --host_copt=-options:strict

Which operating system are you running Bazel on?

windows

What is the output of bazel info release?

release 8.0.0rc6

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 ?

No response

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

first bad commit is 1acfb85

Have you found anything relevant by searching the web?

I believe the following lines introduced the problem.

"//command_line_option:copt": settings["//command_line_option:host_copt"] + ["-g0"], # Don't add for Windows

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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2We'll consider working on this in future. (Assignee optional)team-Rules-CPPIssues for C++ rulesteam-Starlark-IntegrationIssues involving Bazel's integration with Starlark, excluding builtin symbolstype: buguntriaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions