Skip to content

Commit 957bf70

Browse files
committed
Start using clang-cl for Windows Bazel build
With this commit we start using 'clang-cl' to build Mozc for Windows with Bazel. While the original motivation of switching to 'clang-cl' is that protobuf is planning to stop supporting cl.exe with bazel build in protobuf v34 [1], but there is also an on-going build breakage that happens when combining protobuf and abseil-cpp 20250127.0, which is not yet fixed [2]. The latter one is more critical for us because more and more bzlmod dependencies start requiring abseil-cpp 20250127.0 or higher. There must be no impact on Windows GYP build. Closes google#1179. [1]: protocolbuffers/protobuf#20085 [2]: protocolbuffers/protobuf#20331
1 parent 55e2e72 commit 957bf70

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

src/tools/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# tools
2+
3+
This file contains a special [wrapper script for bazelisk](https://github.com/bazelbuild/bazelisk/blob/master/README.md#toolsbazel).
4+
5+
* [bazel.bat](./bazel.bat)

src/tools/bazel.bat

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@echo off
2+
SET selfpath=%~dp0
3+
set BAZEL_LLVM=%selfpath:~0,-6%\third_party\llvm\clang+llvm-19.1.7-x86_64-pc-windows-msvc
4+
%BAZEL_REAL% %* & call:myexit
5+
6+
:myexit
7+
exit /b

src/windows.bazelrc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
# bazel --bazelrc=windows.bazelrc build //protocol:commands_proto \
88
# --config oss_windows
99

10-
# There has been a long standing path-length issue on building protobuf on
11-
# Windows with bazel. See the following for details.
12-
# https://github.com/protocolbuffers/protobuf/issues/12947
13-
# https://github.com/bazelbuild/bazel/issues/18683
14-
# Here is an ugly workaround, which we really hope to get rid of.
15-
startup --output_base=C:/x --windows_enable_symlinks
10+
startup --windows_enable_symlinks
11+
12+
build --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl
13+
build --extra_toolchains=@local_config_cc//:cc-toolchain-x64_x86_windows-clang-cl
14+
build --host_platform=//:host-windows-clang-cl

0 commit comments

Comments
 (0)