rustup works the same on Windows as it does on Unix, but there are some
special considerations for Rust developers on Windows. As mentioned on the
Rust download page, there are two ABIs in use on Windows:
the native (MSVC) ABI used by Visual Studio, and the GNU ABI used by the
GCC toolchain. Which version of Rust you need depends largely on what C/C++
libraries you want to interoperate with: for interop with software produced by
Visual Studio use the MSVC build of Rust; for interop with GNU software built
using the MinGW/MSYS2 toolchain use the GNU build.
When targeting the MSVC ABI, Rust additionally requires an installation of
Visual Studio 2013 (or later) or the Visual C++ Build Tools 2019 so
rustc can use its linker. For Visual Studio, make sure to check the "C++
tools" and "Windows 10 SDK" option. No additional software installation is
necessary for basic use of the GNU build.
rustup on Windows configures Rust to target the MSVC ABI, that is
a target triple of either
depending on the CPU architecture of the host Windows OS. The toolchains that
rustup chooses to install, unless told otherwise through the toolchain
specification, will be compiled to run on that target triple host and will
target that triple by default.
You can change this behavior with
rustup set default-host or during
For example, to explicitly select the 32-bit MSVC host:
$ rustup set default-host i686-pc-windows-msvc
Or to choose the 64 bit GNU toolchain:
$ rustup set default-host x86_64-pc-windows-gnu
Since the MSVC ABI provides the best interoperation with other Windows
software it is recommended for most purposes. The GNU toolchain is always
available, even if you don't use it by default. Just install it with
rustup toolchain install:
$ rustup toolchain install stable-gnu
You don't need to switch toolchains to support all windows targets though; a single toolchain supports all four x86 windows targets:
$ rustup target add x86_64-pc-windows-msvc $ rustup target add x86_64-pc-windows-gnu $ rustup target add i686-pc-windows-msvc $ rustup target add i686-pc-windows-gnu
See the Cross-compilation chapter for more details on specifying different targets with the same compiler.