c:\tools\msys64
(hardcoded into bazel). pacman -Syuu gcc git curl zip unzip zlib-devel
as per instructions. This triggered a bunch of cygwin errors but the command completed. Close the msys2 shell and re-open it.pacman -S python2
also.I downloaded bazel within msys2 shell using the link from the bazel releases page as $ curl -O -J -L https://github.com/bazelbuild/bazel/releases/download/0.4.5/bazel-0.4.5-windows-x86_64.exe
(which I then renamed to bazel.exe
).
Although the bazel windows instructions suggested that VS was only a compile dependency, bazel.exe would not run without it.
Specifically, the cc_configure.bzl
script needed the vsvarsall.bat
script, which is part of Visual Studio.
I already had VS2015 installed, but the C++ build tools were not installed, so I had to get this installed via Control Panel > Programs > Programs and Features
, right click Microsoft Visual Studio Enterprise 2015 with Updates
“Change”, choose the [Modify]
button, and then select the Programming Languages / Visual C++
checkbox. This added 5G of stuff.
A few environment variables needed to be set:
$ env | grep BAZEL
BAZEL_PYTHON=/usr/bin/python2.exe
BAZEL_VS=C:/Program Files (x86)/Microsoft Visual Studio 14.0
BAZEL_SH=c:/tools/msys64/usr/bin/bash.exe
After all that I was able to build a simple java project:
$ ~/bazel.exe run :app
INFO: Found 1 target...
Target //src/main/java:app up-to-date:
C:/tools/msys64/tmp/_bazel_paulj/rklkin_f/execroot/atweb/bazel-out/local-fastbuild/bin/src/main/java/app.jar
C:/tools/msys64/tmp/_bazel_paulj/rklkin_f/execroot/atweb/bazel-out/local-fastbuild/bin/src/main/java/app
C:/tools/msys64/tmp/_bazel_paulj/rklkin_f/execroot/atweb/bazel-out/local-fastbuild/bin/src/main/java/app.cmd
INFO: Elapsed time: 0.540s, Critical Path: 0.01s
INFO: Running command line: C:/tools/msys64/tmp/_bazel_paulj/rklkin_f/execroot/atweb/bazel-out/local-fastbuild/bin/src/main/java/app.cmd
Hello World!
Yay! Good luck.