bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.19k stars 4.06k forks source link

Bazel installed via Scoop doesn't recognize MSYS2 installed via WinGet #23881

Open tats-u opened 3 weeks ago

tats-u commented 3 weeks ago

Description of the bug:

I tried to build Mozc.

I installed Bazel & MSYS2 by the following commands:

scoop install bazel
sudo winget install MSYS2.MSYS2

However, Bazel persisted in finding MSYS2 only in Scoop's directory and couldn't find MSYS2.

I had to reinstall MSYS2 by:

sudo winget uninstall MSYS2.MSYS2
scoop install msys2
msys2

Which category does this issue belong to?

CLI, Core

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

Install Scoop & Visual Studio 2022 Community (or a paid edition instead) first, then:

scoop install bazel
sudo winget install MSYS2.MSYS2
sudo winget install EclipseAdoptium.Temurin.21.JDK # maybe unnecessary
git clone https://github.com/google/mozc.git
cd mozc/src
bazel --bazelrc=windows.bazelrc build --config oss_windows --config release_build package
Action failed to execute: java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("C:\Users\tatsu\scoop\apps\msys2\current\usr\bin\bash.exe" -c "source external/bazel_tools/tools/genrule/genrule-setup.sh; external/_main~_repo_rules~qt_win/bin/rcc.exe -o bazel-out/x64_windows-opt/bin/gui/base/qrc_tr.cc -name qrc_tr gui/base/tr.qrc"): 指定されたファイルが見つかりません。

Or you'll get similar error.

指定されたファイルが見つかりません。 = No designated file found. C:\Users\tatsu\ = The $USERPROFILE of the machine

Which operating system are you running Bazel on?

Windows 11 23H2

What is the output of bazel info release?

release 7.3.2

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

https://github.com/google/mozc.git
ace314567109cbc30dc336fb27844dacff782dd9

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

"msys2 winget" no result

Any other information, logs, or outputs that you want to share?

WinGet installs MSYS2 in C:\msys64.

meteorcloudy commented 3 weeks ago

Did you set BAZEL_SH env var? It looks like Bazel is finding bash at C:\Users\tatsu\scoop\apps\msys2\current\usr\bin\bash.exe which probably doesn't exist?

tats-u commented 3 weeks ago

No, but I'll examine https://github.com/bazelbuild/bazel/blob/a034aa60248f93141f359b9254aee8adf063bfb3/src/main/cpp/blaze_util_windows.cc#L1251 later.

tats-u commented 3 weeks ago

C:\Users\tatsu\scoop\apps\msys2\current\usr\bin\bash.exe which probably doesn't exist?

No, it didn't exist when I tried. (Note: exists now because I reinstalled MSYS2 via Scoop, so I have to uninstall MSYS2 in Scoop and reinstall it via WinGet again to reproduce this issue in my physical machine)