Bazel x86 Compilation Bug on Windows with MSVC
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the bug:
The bug occurs when using Bazel on Windows with MSVC and the C++ toolchain to target a 32-bit (x86) build. Despite specifying x86 as the target, setting --cpu=x86_windows and --host_cpu=x86_windows in .bazelrc, and ensuring all necessary Windows-specific configurations are present, the produced binary is actually built as a 64-bit (x64) executable. This can be verified by running the Dumpbin /headers command on the binary, which reveals that the header information still indicates an x64 architecture.
### Which category does this issue belong to?
C++ Rules
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
The link to the example which is a Simple Calculator DLL library that supports both Bazel and CMake build systems
https://github.com/farnoodfma/Simple-Calculator-Library/tree/main
### Which operating system are you running Bazel on?
Windows
### What is the output of `bazel info release`?
release 8.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 HEAD` ?
```text
```
### If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
I do not know.
### Have you found anything relevant by searching the web?
This issue may be related: https://github.com/bazelbuild/bazel/issues/22164
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Research direction
Start with the linked Simple-Calculator-Library example and reproduce the Bazel 8.0.0 build on Windows with MSVC, using the reported .bazelrc settings. Inspect the output with Dumpbin /headers and compare the behavior with issue #22164; done means the x86 target produces a binary whose headers identify it as x86 rather than x64.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100