Git pre-commit hook for tidy check uses GNU toolchain on windows by default #78150
Labels
C-bug
Category: This is a bug.
O-windows
Operating system: Windows
O-windows-msvc
Toolchain: MSVC, Operating system: Windows
T-bootstrap
Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
x.py setup
offers to install a pre-commit hook that runsx.py test tidy --bless
. Under Windows, when this hook runs and ifbuild
isn't set inconfig.toml
,x.py
will always try to compile using the GNU toolchain and use GCC's linker which may not be present in which case it fails.It happens when you're using "Git for Windows", which is probably the most common way to install git on Windows.
I can compile rustc with the MSVC toolchain. Running
python x.py test tidy --bless
succeeds when started from a powershell window. It throws the same errors as the git hook when run from a git bash terminal.I suppose
x.py
can't distinguish git's MinGW environment from a separately installed MinGW? Relevant function in the script that decides the build triple:rust/src/bootstrap/bootstrap.py
Line 190 in 9832374
I expected to see this happen:
Use the MSVC toolchain to compile and run
tidy
, especially when run from a powershell terminal.Instead, this happened:
It tried to use the GNU toolchain from inside Git's MinGW environment, but GCC doesn't exist so it fails.
Error
As I'm only using MSVC, I can workaround this by setting
[build]\nbuild = "x86_64-pc-windows-msvc"
inconfig.toml
.The text was updated successfully, but these errors were encountered: