Problem
Rocket's Windows CI (Azure Pipelines) started failing between 27 and 4 days ago. We run this command:
curl -sSf -o rustup-init.exe https://win.rustup.rs
rustup-init.exe -y --default-toolchain $(rust_version)
And the output looks like this:
========================== Starting Command Output ===========================
"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "d:\a\_temp\8545808c-7a04-4daf-ad75-cd45a608d93d.cmd""
info: profile set to 'default'
info: default host triple is i686-pc-windows-msvc
error: toolchain 'stable' is not installed
error: caused by: not a directory: 'C:\Users\VssAdministrator\.rustup\toolchains\stable-i686-pc-windows-msvc'
##[error]Cmd.exe exited with code '1'.
Finishing: Install Rust (nightly)
In a previous successful run, this was the output:
========================== Starting Command Output ===========================
"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\60e92b2b-f745-49cf-b841-7987dd621bcc.cmd""
info: profile set to 'default'
info: default host triple is x86_64-pc-windows-msvc
info: updating existing rustup installation
Steps
I have not attempted to reproduce this yet. I'll try locally first, but I would not be surprised if there's some kind of caching going on from a previous installation that will make reproduction difficult.
Analysis
Two things about this seem really odd to me: i686 (maybe related to #2179?) and stable when the requested version was nightly. I don't know if it's trying to find the stable toolchain before or during a self-update, assuming it is trying to do one.
Any hints before I go and try this on bare metal?
Update: I tried this on my machine today and got something normal-looking:
PS C:\Users\jeb\Downloads> '.\rustup-init.exe' -y --default-toolchain nightly
info: profile set to 'default'
info: default host triple is x86_64-pc-windows-msvc
info: updating existing rustup installation
(...)
IIRC Azure's setup is very odd and breaks rustup quite badly because of how they do layering for preinstalled stuff. I've had fewer issues with github actions, so perhaps they fixed things in there?
FYI: I had this on a personal project as well. Adding explicit host triple made it work again:
--default-host x86_64-pc-windows-msvc
That flag seems to have worked for us, as well.
Is there any chance the host detection changed in 1.21 either for better or worse that could be making this necessary?
Alternatively, I wonder if the builders were changed in some way (e.g. from 32-bit to 64-bit) without clearing any caches.
@nikodemus Thank you! Your solution works for me as well.
is your curl an x86-64 curl?
Are you running from a “script” block or “bash” block?
This is what I have now (which works, with the explicit --default-host.)
- script: |
curl -sSf -o rustup-init.exe https://win.rustup.rs
rustup-init.exe -y --profile minimal --default-host x86_64-pc-windows-msvc --default-toolchain stable
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin"
displayName: Windows install rust
condition: eq( variables['Agent.OS'], 'Windows_NT' )
What’s weird about this is how it ever worked 😄
From all I have read it should have always been downloading and installing the 32-bit version... 🤔
As of this, the right thing should be happening:
https://github.com/rust-lang/rustup/issues/2179#issuecomment-578880995
We do this in a script block.
curl --version just says "Windows", but where reports that curl is: C:\Windows\System32\curl.exe (🤨) or possibly C:\Program Files\Git\mingw64\bin\curl.exe.
7z l C:\Windows\System32\curl.exe | findstr CPU gives me:
C:\Program Files\Git\mingw64\bin\curl.exe
CPU = x64
So it seems likely it's a 64-bit curl.
If you're using win.rustup.rs then it will always download a 32 bit installer which should pick an installer which matches your platform but may incorrectly select a 32bit one instead. In CI it's recommended to install with explicit host triples or perhaps even to set it in a separate action and then install the toolchain. That protects you against changes in the underlying infrastructure more effectively.
@rustbot label: +O-windows