Reputation: 473
I'm trying to build bazel on a Windows machine, but bazel build //src:bazel
does not find any target to build:
$ bazel build //src:bazel
Loading:
Loading: 0 packages loaded
INFO: Analysed 0 targets (0 packages loaded).
INFO: Found 0 targets...
[0 / 1] [-----] BazelWorkspaceStatusAction stable-status.txt
INFO: Elapsed time: 0.389s, Critical Path: 0.01s
INFO: Build completed successfully, 1 total action
To be clear: This is happening only with master, I was able to build the 0.10.1 dist version of Bazel (from github) on my Windows machine.
To make sure my 0.10.1 binary is okay I built the cpp example (//examples/cpp:hello-world). It worked as expected - no failures.
I was able to build a stable dist version (namely, 0.10.1)bazel master on a Linux and macOS machines.
Any help here would be greatly appreciated.
Upvotes: 2
Views: 4757
Reputation: 4271
It looks like you are running Bazel from MSYS Bash. This is no longer necessary, because Bazel is a native Windows binary since version 0.5.0.
MSYS thinks the argument //src:bazel
is a Unix-style path (because it starts with /
) so it converts the "path" for Bazel to a Windows path. IIRC the conversion logic just removes one /
and the target pattern ends up being /src:bazel
.
As a solution, I suggest one of the following:
Run Bazel from cmd.exe
or from Powershell. This is how I use Bazel and it works as expected.
Disable the path conversion heuristic in MSYS:
export MSYS_NO_PATHCONV=1
export MSYS2_ARG_CONV_EXCL="*"
Use ///
instead of //
in the target path. This only works under MSYS and I don't think it's reliable because I don't understand MSYS's path conversion logic, so I don't recommend this solution but here it is anyway:
bazel build ///src:bazel
Upvotes: 6