This page captures the progress of Bazel for windows on arm.
Bazel changes to enable WoA has been upstreamed and are present on the trunk.
Bazel changes are ported to the 5.1 release branch.
Bazel releases are available from https://github.com/bazelbuild/bazel/releases
Bazelisk (launcher for Bazel) doesn’t yet have support for woa.
Bazel pre-built binaries for woa are available
https://github.com/bazelbuild/bazel/releases
Bazel can be built from the source and requires an x64 bazel for cross-compilation.
You need Bazel(x64) 5 or later.
bazel build --subcommands --cpu=x64_arm64_windows //src:bazel.exe |
This generates a standalone bazel.exe
which is a native arm64 Bazel binary.
Bazel binaries for WoA are published as part of Bazel CI and every commit generates a build.
An example built from an old commit. Replace the commit id with one of the latest to access latest builds.
You might need to explicitly add an exe
suffix to the generated binary to execute it.
Using the examples provided in https://docs.bazel.build/versions/main/tutorial/cpp.html
For targeting windows/arm64
, the following flag needs to be specified
--cpu=arm64_windows
For native compilation, target CPU is auto-detected and explicit target is not required.
Few examples given below,
bazel build --subcommands //main:hello-world --cpu=arm64_windows
bazel build --subcommands //main:hello-world