-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong assembler selected for @local_config_cc//:cc-toolchain-x64_windows-clang-cl #23128
Comments
It looks like this can indeed be fixed by changing the paths for both Here is a attached a modified version of the test, but this time with a modified version of >bazel build //...
INFO: Analyzed 3 targets (79 packages loaded, 2890 targets configured).
INFO: From Compiling external/rules_boost~override~non_module_dependencies~boost/libs/context/src/asm/ontop_x86_64_ms_pe_masm.S:
MASM : warning A4018:invalid command-line option : /bigobj
MASM : warning A4018:invalid command-line option : /Zm500
MASM : warning A4018:invalid command-line option : /Z500
MASM : warning A4018:invalid command-line option : /Z00
MASM : warning A4018:invalid command-line option : /Z0
MASM : warning A4018:invalid command-line option : /EHsc
MASM : warning A4018:invalid command-line option : /wd4351
MASM : warning A4018:invalid command-line option : /wd4291
MASM : warning A4018:invalid command-line option : /wd4250
MASM : warning A4018:invalid command-line option : /wd4996
MASM : warning A4018:invalid command-line option : /showIncludes
Assembling: bazel-out/x64_windows-fastbuild/bin/external/rules_boost~override~non_module_dependencies~boost/libs/context/src/asm/ontop_x86_64_ms_pe_masm.S
INFO: From Compiling external/rules_boost~override~non_module_dependencies~boost/libs/context/src/asm/jump_x86_64_ms_pe_masm.S:
MASM : warning A4018:invalid command-line option : /bigobj
MASM : warning A4018:invalid command-line option : /Zm500
MASM : warning A4018:invalid command-line option : /Z500
MASM : warning A4018:invalid command-line option : /Z00
MASM : warning A4018:invalid command-line option : /Z0
MASM : warning A4018:invalid command-line option : /EHsc
MASM : warning A4018:invalid command-line option : /wd4351
MASM : warning A4018:invalid command-line option : /wd4291
MASM : warning A4018:invalid command-line option : /wd4250
MASM : warning A4018:invalid command-line option : /wd4996
MASM : warning A4018:invalid command-line option : /showIncludes
Assembling: bazel-out/x64_windows-fastbuild/bin/external/rules_boost~override~non_module_dependencies~boost/libs/context/src/asm/jump_x86_64_ms_pe_masm.S
INFO: From Compiling external/rules_boost~override~non_module_dependencies~boost/libs/context/src/asm/make_x86_64_ms_pe_masm.S:
MASM : warning A4018:invalid command-line option : /bigobj
MASM : warning A4018:invalid command-line option : /Zm500
MASM : warning A4018:invalid command-line option : /Z500
MASM : warning A4018:invalid command-line option : /Z00
MASM : warning A4018:invalid command-line option : /Z0
MASM : warning A4018:invalid command-line option : /EHsc
MASM : warning A4018:invalid command-line option : /wd4351
MASM : warning A4018:invalid command-line option : /wd4291
MASM : warning A4018:invalid command-line option : /wd4250
MASM : warning A4018:invalid command-line option : /wd4996
MASM : warning A4018:invalid command-line option : /showIncludes
Assembling: bazel-out/x64_windows-fastbuild/bin/external/rules_boost~override~non_module_dependencies~boost/libs/context/src/asm/make_x86_64_ms_pe_masm.S
INFO: Found 3 targets...
INFO: Elapsed time: 8.296s, Critical Path: 2.15s
INFO: 12 processes: 4 internal, 8 local.
INFO: Build completed successfully, 12 total actions Note that my system has MSVC and LLVM installed into non-default locations, so the paths will likely need to be adjusted for other machines. However, the principle is the same. |
Would you be interested in sending a PR? |
Sure, I'll try to have something up soon. |
Assembly files are not valid inputs for `clang-cl.exe`; the MSVC `ml64.exe` must be used instead. Fixes bazelbuild#23128. Closes bazelbuild#23337. PiperOrigin-RevId: 666406544 Change-Id: Ia7a5fc4702f08a5754145ca286c079d1a4f0e204
Assembly files are not valid inputs for `clang-cl.exe`; the MSVC `ml64.exe` must be used instead. Fixes bazelbuild#23128. Closes bazelbuild#23337. PiperOrigin-RevId: 666406544 Change-Id: Ia7a5fc4702f08a5754145ca286c079d1a4f0e204
A fix for this issue has been included in Bazel 7.4.0 RC1. Please test out the release candidate and report any issues as soon as possible. |
Unfortunately, the fix PR for this broke building assembly code for me... With Bazel 7.4.0, compiling a |
@fhanau Can you please file an issue and provide a reproducible case? @michaelsiegrist Have you encountered similar problem after #23337 ? |
Description of the bug:
When compiling a
cc_library
with assembly (.S
) files as input, the@local_config_cc//:cc-toolchain-x64_windows-clang-cl
toolchain selectsclang-cl.exe
as the executable. However,clang-cl
is not intended to handle assembly; as withcl.exe
from the MSVC toolchain, it only accepts C/C++ code as input.Comparing the Windows clang-cl and MSVC toolchains, it looks like the MSVC toolchain properly selects
ml64.exe
for assembly files, but the clang-cl toolchain usesclang-cl
.MSVC toolchain,
tool_paths["ml"] = "C:/Tools/ms/vs/2022/17.4.11/VC/Tools/MSVC/14.34.31933/bin/HostX64/x64/ml64.exe"
:Clang-cl toolchain,
tool_paths["ml"] = "C:/Tools/llvm/16.0.2/bin/clang-cl.exe"
:It seems that the clang-cl toolchain should also be using
ml64.exe
or perhapsllvm-as
to properly compile assembly files.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.
bazel-test.zip
The example contains a single
cc_library()
target//:test
that depends on@boost//:context
, which in turn has some pre-generated assembly files listed in itssrcs
. The project is configured to use the Windows clang-cl toolchain described in the Bazel Windows documentation. After setting%BAZEL_VC%
and%BAZEL_LLVM%
to the appropriate paths (MSVC version 17.4.11 and LLVM 16.0.2), I compile and get the following:Looking at the params file used for the compilation shows the following:
Which operating system are you running Bazel on?
Windows Server 2016
What is the output of
bazel info release
?release 7.0.0
If
bazel info release
returnsdevelopment 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.
No response
Have you found anything relevant by searching the web?
According to this SO answer,
cl.exe
does not support compiling assembly;ml64.exe
is needed for that.Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: