Skip to content
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

Windows: Bazel requires MSYS for every command #6462

Closed
laszlocsomor opened this issue Oct 22, 2018 · 7 comments
Closed

Windows: Bazel requires MSYS for every command #6462

laszlocsomor opened this issue Oct 22, 2018 · 7 comments
Assignees
Labels
area-Windows Windows-specific issues and feature requests P2 We'll consider working on this in future. (Assignee optional) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug

Comments

@laszlocsomor
Copy link
Contributor

Description of the problem / feature request:

On a fresh Windows 10 installation with only Bazel 0.18.0 and MSVC redistributable DLLs [1] and without MSYS, running any command in a minimal workspace (just an empty WORKSPACE file) requires MSYS bash.

[1] https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

On a fresh Windows 10:

  1. download Bazel 0.18.0
  2. install the MSVC redistributable DLLs
  3. in cmd.exe:
C:\>md c:\src\foo

C:\>cd c:\src\foo

C:\src\foo>echo # hello>WORKSPACE

C:\src\foo>bazel info release
Bazel on Windows requires MSYS2 Bash, but we could not find it.
If you do not have it installed, you can install MSYS2 from
       http://repo.msys2.org/distrib/msys2-x86_64-latest.exe

If you already have it installed but Bazel cannot find it,
set BAZEL_SH environment variable to its location:
       set BAZEL_SH=c:\path\to\msys2\usr\bin\bash.exe
[bazel ERROR src/main/cpp/blaze_util_windows.cc:1453] bash.exe not found on PATH
[bazel INFO src/main/cpp/blaze_util_windows.cc:1473] BAZEL_SH detection took 0 msec, found

What operating system are you running Bazel on?

Windows Server 2016 (v1607)

@laszlocsomor laszlocsomor changed the title Windows: Bazel requires MSYS for any command Windows: Bazel requires MSYS for every command Oct 22, 2018
@laszlocsomor laszlocsomor self-assigned this Oct 22, 2018
@laszlocsomor laszlocsomor added type: bug P2 We'll consider working on this in future. (Assignee optional) area-Windows Windows-specific issues and feature requests labels Oct 22, 2018
@laszlocsomor
Copy link
Contributor Author

This is a bad first-time experience. See #5254

laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Nov 2, 2018
Fixes bazelbuild#6462

Change-Id: I6792b6d3be7ea0d31154a4c3cb9983c601689301
@robisim74
Copy link

@laszlocsomor

I get the same error: Bazel on Windows requires MSYS2 Bash, but we could not find it for every command using the binaries for Bazel provided by the @bazel/bazel v0.20.0 npm package.

So the only way to run Bazel on Windows is to install MSYS2 bash and disable the path conversion?

The doc says to prefer Command Prompt or PowerShell: https://docs.bazel.build/versions/master/windows.html#running-bazel-msys2-shell-vs-command-prompt-vs-powershell

@laszlocsomor
Copy link
Contributor Author

@robisim74 : try Bazel 0.21, that should no longer complain about a missing MSYS2 Bash. Please let me know if you still find problems with it!

@robisim74
Copy link

Ok, thanks! I will try to install v0.21 (still not published on npm) and let you know.

@robisim74
Copy link

@laszlocsomor I tried to download version 0.21 directly on my machine in c:\bazel, and run C:\> .\bazel help, but nothing: same error.

For the moment, I installed MSYS2 bash to work.

@laszlocsomor
Copy link
Contributor Author

@robisim74 : You're right. I never merged the corresponding PR (#6582) because it broke some tests.

Installing MSYS2 is the best "workaround" for now. Sorry about that.

@laszlocsomor
Copy link
Contributor Author

Bazel 0.23 still complains about missing MSYS2:

C:\src\tmp>c:\Users\laszlocsomor\Downloads\bazel-0.23.0-windows-x86_64.exe info release
ERROR: bash.exe not found on PATH
Bazel on Windows requires MSYS2 Bash, but we could not find it.
If you do not have it installed, you can install MSYS2 from
       http://repo.msys2.org/distrib/msys2-x86_64-latest.exe

If you already have it installed but Bazel cannot find it,
set BAZEL_SH environment variable to its location:
       set BAZEL_SH=c:\path\to\msys2\usr\bin\bash.exe
[bazel ERROR src/main/cpp/blaze_util_windows.cc:1462] bash.exe not found on PATH
[bazel INFO src/main/cpp/blaze_util_windows.cc:1477] BAZEL_SH detection took 0 msec, found

laszlocsomor added a commit to laszlocsomor/bazel that referenced this issue Mar 7, 2019
Bazel no longer reports an error if it fails to
locate Bash. This allows "bazel info release" to
work even in absence of Bash.

To clarify, Bazel still requires Bash to build
rules that depend on Bash. This PR simply removes
the fatal error Bazel used to display if Bash was
missing even when Bash was not required.

Fixes bazelbuild#6462
@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Windows Windows-specific issues and feature requests P2 We'll consider working on this in future. (Assignee optional) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants