-
Notifications
You must be signed in to change notification settings - Fork 0
Doc how to install an unofficial nightly for Windows
WARNING: Every nightly snapshot mentioned in this document is unofficial and not maintained by the Rust core team. You are fully responsible for any problems due to the use of nightly snapshots.
Download and run the MinGW installer and follow the instructions. There is a checkbox for whether to install the graphical user interface, which we will not use but nevertheless may be useful.
TIP: You can install the GUI later using
mingw-get install mingw-get-gui
.
MinGW, by default, does not append itself to the PATH
environment variable.
Since running rustc
anywhere requires this environment variable,
you should append a path to the MinGW executables to PATH
in the control panel.
(In the default settings, the path would be C:\MinGW\bin
.)
Turn the Command Prompt on and type the following.
> mingw-get install mingw32-base
TIP: This would install the C compiler. If you don't want it, use
mingw-get install gcc
instead.
Install Chocolatey by copying the command line in the website and pasting it into the Command Prompt.
> @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
TIP: When you get an error (mostly due to older versions of PowerShell), use an alternative method to install.
Then install Rust using Chocolatey. We will use the NuGet Rust package maintained by Heather. Since NuGet is not a default package feed as of 2014-02, we will manually add it to the available sources. Installing Rust would take some time as it weighs about 120 MB.
> choco sources add -name nuget -source https://www.nuget.org/api/v2/
> choco install Rust
TIP: If you get the "Unable to read package from path" error shortly after
choco install
, you have the incomplete NuGet package cache. Delete everything starting withRust
in%AppData%\Local\NuGet\Cache
and try again.
choco install
would install C:\Chocolatey\lib\Rust.VERSION\bin\rustc.exe
and so on.
Try rustc -v
out in the Command Prompt and check if it installs the correct version.
TIP: If you get an error about not being able to find
libstdc++-6.dll
or other dlls when runningrustc
, install themingw32-gcc-g++
package from mingw as well.
You can update the Rust installation using Chocolatey later.
> choco update Rust
MinGW has a subsystem named MSYS which emulates a conventional Unix shell.
This subsystem is required for projects depending on Unix build systems like make
,
and it's a must for building the Rust compiler.
Follow all the instructions for MinGW, then type the following in order to install MSYS.
> mingw-get install msys-base
Then run msys\1.0\msys.bat
in the MinGW directory.
TIP: Installing MSYS does not automatically generate a shortcut to it. You are recommended to make a shortcut for
msys.bat
.
TIP: If you've installed MSYS in your own way, and especially if you don't have a path to MinGW in
PATH
, then you need to run/postinstall/pi.sh
in the MSYS shell and follow the instructions. (You normally don't need that, however.)
rustc
installed via Chocolatey works well with MSYS,
but you can't directly run it since the MSYS shell (currently) can't run batch files generated by Chocolatey.
You need to make the following files in the MinGW directory by hand...
msys\1.0\bin\rustc
msys\1.0\bin\rustdoc
msys\1.0\bin\rustpkg
...with the following contents.
#!/bin/sh
cmd //c $(basename "$0") "$@"
You can now use rustc
directly in the MSYS shell.