-
Notifications
You must be signed in to change notification settings - Fork 385
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
See if we can use clang-cl
to build Mozc for Windows with Bazel
#1179
Comments
hiroyuki-komatsu
added a commit
that referenced
this issue
Feb 12, 2025
Due to the build error on Windows (#1179).
One of the blocker is the fact that |
yukawa
added a commit
to yukawa/mozc
that referenced
this issue
Feb 15, 2025
This is a preparation to build Mozc for Windows with clang-cl (google#1179). This commit pulls my pull request [1] to let rules_cc register clang-cl as a valid toolchain to build x86 (32-bit) Windows executables. While when and how my pull request will get merged into upstream, having these local patches allows us to go ahead to see if we can fully migrate to clang-cl or not. There must be no impact on Bazel with msvc build in this commit. [1]: bazelbuild/rules_cc#360
hiroyuki-komatsu
pushed a commit
that referenced
this issue
Feb 18, 2025
This is a preparation to build Mozc for Windows with clang-cl (#1179). This commit pulls my pull request [1] to let rules_cc register clang-cl as a valid toolchain to build x86 (32-bit) Windows executables. While when and how my pull request will get merged into upstream, having these local patches allows us to go ahead to see if we can fully migrate to clang-cl or not. There must be no impact on Bazel with msvc build in this commit. [1]: bazelbuild/rules_cc#360 PiperOrigin-RevId: 728118916
yukawa
added a commit
to yukawa/mozc
that referenced
this issue
Feb 18, 2025
This is a preparation before supporting 'clang-cl' for Windows (google#1179). Our plan is to download LLVM for Windows in 'update_deps.py', and in that process we would like to use 'ProgressPrinter' to show progress for both downloading the archive and extracting it. To avoid code duplicate between 'build_qt.py' and 'update_deps.py', let's extract 'ProgressPrinter' into a new file first. This is a mechanical refactoring commit. There must be no observable behavior change.
hiroyuki-komatsu
pushed a commit
that referenced
this issue
Feb 21, 2025
This is a preparation before supporting 'clang-cl' for Windows (#1179). Our plan is to download LLVM for Windows in 'update_deps.py', and in that process we would like to use 'ProgressPrinter' to show progress for both downloading the archive and extracting it. To avoid code duplicate between 'build_qt.py' and 'update_deps.py', let's extract 'ProgressPrinter' into a new file first. This is a mechanical refactoring commit. There must be no observable behavior change. PiperOrigin-RevId: 729457855
yukawa
added a commit
to yukawa/mozc
that referenced
this issue
Feb 21, 2025
As a preparation to start using clang-cl for Windows (google#1179), with this commit python build_tools/update_deps.py will start deploying LLVM for windows into src/third_party/llvm/ by downloading the archive from LLVM's GitHub releases page. The downloaded clang-cl is not yet used.
yukawa
added a commit
to yukawa/mozc
that referenced
this issue
Feb 21, 2025
As a preparation to start using clang-cl for Windows (google#1179), with this commit python build_tools/update_deps.py will start deploying LLVM for windows into src/third_party/llvm/ by downloading the archive from LLVM's GitHub releases page. The downloaded clang-cl is not yet used.
yukawa
added a commit
to yukawa/mozc
that referenced
this issue
Feb 21, 2025
As a preparation to start using clang-cl for Windows (google#1179), with this commit python build_tools/update_deps.py will start deploying LLVM for windows into src/third_party/llvm/ by downloading the archive from LLVM's GitHub releases page. The downloaded clang-cl is not yet used.
yukawa
added a commit
to yukawa/mozc
that referenced
this issue
Feb 23, 2025
This is a preparation to build Mozc for Windows with clang-cl (google#1179). Now that Windows Bazel builds rely on CC toolchain resolution (google#1112), 'clang-cl' needs to be picked up based on 'platform' specified to Bazel. This gives us an inverse problem what needs to be passed to Bazel so that such a resolution can happen. The simplest solution as far as I have figures out is doing the following two steps. 1. Specify '--host_platform=//:host-windows-clang-cl', where it is defined as follows. platform( name = "host-windows-clang-cl", constraint_values = [ "@platforms//os:windows", "@bazel_tools//tools/cpp:clang-cl", ], parents = ["@local_config_platform//:host"], ) By doing this, '@bazel_tools//tools/cpp:clang-cl' can be propagated into each execution platform, which is mandatory for 'clang-cl' to be picked up. 2. Specify '--extra_toolchains' command line options to put the following toolchains from 'rules_cc' in higher priority than cl.exe. * '@local_config_cc//:cc-toolchain-x64_x86_windows-clang-cl' * '@local_config_cc//:cc-toolchain-x64_windows-clang-cl' This is important because CC toolchain resolution picks up the first toolchain that satisfies all the constraints. To give a higher priority to 'clang-cl' toolchains, they need to be registered before 'cl' toolchains are registered. Note that register_toolchains("@local_config_cc//:all") in 'MODULE.bazel' registers toolchains in the alphabeticall order. To give a higher priority to 'clang-cl' toolchains, '--extra_toolchains' command line looks to be the best way. What this commit does is the step 1. Without the step 2, there must be no observable behavior change yet.
yukawa
added a commit
to yukawa/mozc
that referenced
this issue
Feb 23, 2025
This is a preparation to build Mozc for Windows with clang-cl (google#1179). Now that Windows Bazel builds rely on CC toolchain resolution (google#1112), 'clang-cl' needs to be picked up based on 'platform' specified to Bazel. This gives us an inverse problem what needs to be passed to Bazel so that such a resolution can happen. The simplest solution as far as I have figures out is doing the following two steps. 1. Specify '--host_platform=//:host-windows-clang-cl', where it is defined as follows. platform( name = "host-windows-clang-cl", constraint_values = [ "@platforms//os:windows", "@bazel_tools//tools/cpp:clang-cl", ], parents = ["@local_config_platform//:host"], ) By doing this, '@bazel_tools//tools/cpp:clang-cl' can be propagated into each execution platform, which is mandatory for 'clang-cl' to be picked up. 2. Specify '--extra_toolchains' command line options to put the following toolchains from 'rules_cc' in higher priority than cl.exe. * '@local_config_cc//:cc-toolchain-x64_x86_windows-clang-cl' * '@local_config_cc//:cc-toolchain-x64_windows-clang-cl' This is important because CC toolchain resolution picks up the first toolchain that satisfies all the constraints. To give a higher priority to 'clang-cl' toolchains, they need to be registered before 'cl' toolchains are registered. Note that register_toolchains("@local_config_cc//:all") in 'MODULE.bazel' registers toolchains in the alphabetical order. To give a higher priority to 'clang-cl' toolchains, '--extra_toolchains' command line looks to be the best way. What this commit does is the step 1. Without the step 2, there must be no observable behavior change yet.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Spun off from the following issues.
third_party/protobuf
to v30.0 #1177The build failure in protobuf with bazel and
cl.exe
due to path length limit has been an issue in Mozc as well.As you can see below, we are now passing
--output_base=C:/x
to shorten the absolute path.mozc/src/windows.bazelrc
Lines 10 to 15 in 3baa8d8
If protobuf team is even giving up this workaround, maybe it's time for us to switch to
clang-cl.exe
as well.Let's see what tasks need to be done to switch to
clang-cl.exe
in Mozc.Version or commit-id
3baa8d8
Environment
The text was updated successfully, but these errors were encountered: