In this paper we describe how to install and run Rust compilers in Windows 10 and 11 using ABI GNU instead of MSVC, which is the default installer. This guide helps you set up the Rust development area on Windows and compile your program using the Rust language.
Nowadays, Rust programming languages have become so popular, and many programmers try to learn and master this newborn language. Also, companies search for people who are masters at Rust. If you are one of the people trying to learn this skill, we offer you a Master The Rust Programming Language : Beginner To Advanced course. By using this course you can take advantage of related job opportunities.

Install Rust with rustup tool
rustup tool is manager of the Rust version, which easily installs and keeps toolchains in Rust. To install rustup, follow the steps:
Go to the Rust installing official page or use the code below in PowerShell or CMD environments:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
This code launches the installation process and helps you pass the initial steps of installing. After finishing, make sure rustup is installed successfully. You can check it by running this code:
rustup --version
By default, Rust uses the MSVC version, so to change to the GNU version, follow these steps:
Install Toolchain GNU:
rustup toolchain install stable-x86_64-pc-windows-gnu
Set the default version to GNU:
rustup default stable-x86_64-pc-windows-gnu
Add GNU target to Toolchian:
rustup target add x86_64-pc-windows-gnu
These commands ensure you use GNU-related settings when compiling programs.
Installing necessary tools for linker
When using ABI GNU, you need a linker of GNU package tools such as mingw-w64. To do so, the best choice is to use the MSYS2 environment.
Download and install MSYS2:
Visit the msys2.org website, then download and install your window appropriate version.
Update MSYS2:
After installing, run MSYS and enter the commands below to update MSYS2 packages:
pacman -Syu
If you need, close the terminal and reopen it and repeat the update command.
Installing the GNU (mingw-w64) compiler:
pacman -S mingw-w64-x86_64-gcc
After installing, with the below command, check if the correct version of gcc is available:
gcc --version
These steps provide a necessary environment to link Rust programs with ABI GNU.
Compile Rust programs with ABI GNU
Now that Rust environments with related tools are ready, you can compile Rust programs with ABI GNU easily. There are two common ways to do so:
First: using rustc
Suppose your program file with the name rust_hello.rs exists. On this command line, compile your program directly:
rustc --target=x86_64-pc-windows-gnu rust_hello.rs
The above command generates an executable file that uses GNU settings.
Second: use of Cargo (Rust package tool manager)
Cargo is the default tool for managing Rust projects that makes dependencies and creating processes easy. In the project directory, by having a Cargo.toml file, you can run the below command:
cargo build --target=x86_64-pc-windows-gnu
This method is recommended because it makes dependency management and project making easy.
Supplementary tips
Fix linking errors:
If you face errors such as link.exe not found, remember this error is related to the MSVC environment. By using the toolchain GNU and installing mingw-w64 correctly, this problem will be fixed.
Checking Rust installation:
Running the command below helps you make sure Rust has been installed correctly:
rustc --version cargo --version
“Can’t find crate for std” error:
If you face such an error, make sure the GNU target is installed and has been added correctly:
rustup target add x86_64-pc-windows-gnu

Conclusion
By following the instructions in this paper, the Rust development environment will be set completely to use ABI GNU. This method is especially appropriate for developers who use assigned GNU tools such as mingw-w64 and can prevent some MSVC-related problems. Now you are ready to compile your programs and enjoy Rust’s advanced facilities.