Skip to content

Replaced clang-cl for MSVC Compiler on Windows - #2460

Merged
hzeller merged 2 commits into
chipsalliance:masterfrom
corco:msvc
Aug 8, 2026
Merged

Replaced clang-cl for MSVC Compiler on Windows#2460
hzeller merged 2 commits into
chipsalliance:masterfrom
corco:msvc

Conversation

@corco

@corco corco commented Oct 1, 2025

Copy link
Copy Markdown
Collaborator

MSVC is the default compiler on Windows and switching verible to use it would alleviate some pain points of using bazel on Windows.

For context, clang-cl was originally used because designated identifiers are used in the codebase, which are only supported by C++20 in MSVC, which was not available at the time. Also, MSVC would crash on the codebase, which is no longer the case.

I left the option to use clang-cl, but this is theory as I don't have a Windows system to verify. I removed reference to clang-cl from the doc, so this support is only for devs actively looking for it. It could be removed from .bazelrc if you prefer. As a side note, I don't think adding clang-cl to CI has value since we already build with clang on Linux.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 1, 2025

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

@hzeller

hzeller commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Were you able to resolve the compile issue in the CI ? (i can't see the log anymore, so maybe you have to rebase and re-trigger).

It would be interesting to see if we can also make
#2524
working with this change, then we can avoid the extra work with the flex/bison to be installed.

@corco

corco commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

I don't remember where it failed, it was either on tests or other platforms.

I don't have a Windows box anymore, and the main issue (tree-operations.h) is still beyond my comprehension. I am putting AI to the task, it seems to have a reasonable fix for it.

@corco
corco force-pushed the msvc branch 2 times, most recently from f7a3968 to a5b4b19 Compare August 4, 2026 01:48
@hzeller

hzeller commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Uh, I wonder what is up with the protobuf include in the context of rust that is breaking...
But overall looks like you're making good progrress, thanks!

@corco

corco commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

Uh, I wonder what is up with the protobuf include in the context of rust that is breaking...

But overall looks like you're making good progrress, thanks!

That's the reason MSVC was deprecated (protocolbuffers/protobuf#20085). A newer bazel version is required to compile without error.

I think we have a path forward with MSVC, the code change is minimal. However, it requires updating bazel in order to compile protobuf. The update to protobuf itself is optional, we can keep the current version if we add the right compile flag.

Updating bazel should be a separate task, once it's done we can merge MSVC support.

@hzeller

hzeller commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

So to move to bazel 8, we need to solve the flex-bison issue #2435

I have two solutions, somewhat sitting as drafts, that should be re-activated.

So to resolve this, we might start with #2520 which allows to move to bazel8.
Then get your Windows change in, and then see if we get more luck with driving forward #2524 with MSVC.

So here might be a sequence:

  • Please break this change here into independent parts that should work in any case, the iterator and template changes in editscript, tree utils and such. That we then can get in independently. That leaves us to hopefully only needing to then later update the .bazelrc
  • I submit Make biso/flex work with local and BCR tools work with bazel 8 #2520 moving us to bazel8+ (I'll add you as reviewer)
  • ^^ The above two can be done in parallel.
  • You can add the change that changes the compiler in .bazelrc (essentially this PR, but only the compiler change)
  • At that point, we can build everything with bazel 8 and bazel 9 on all operating systems and in particular with msvc on Windows.
  • then I can re-tackle Use flex and bison directly instead from toolchain. #2524 and see if this will be easier or harder.

@hzeller

hzeller commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Added you as reviewer of #2520 so that we can get bazel 8+ unlocked.

@corco

corco commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

Added you as reviewer of #2520 so that we can get bazel 8+ unlocked.

I will modify the PR to only include code changes.

Meanwhile, have you looked at the changes in bazel/ directory from this PR? This is what the AI came up with (along with --action_env=PATH line in .bazelrc). I don't mind either that or #2520, but I think the no_toolchain is a little cleaner.

@hzeller

hzeller commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

ah, nice. I agree, the no-toolchain solution looks better.

@corco
corco marked this pull request as ready for review August 8, 2026 02:55
@corco

corco commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

Alright, I split this PR and the other section are merged. All left is update to .bazelrc and ci to actually use msvc!

@hzeller hzeller left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you!

@hzeller
hzeller merged commit 93141f4 into chipsalliance:master Aug 8, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants