Are you on a computer where you cannot get MSVC on a computer because of admin? Well, this guide should help you out!
Note
This guide is only for windows.
- Download rustup/rust-init for windows. Download from here: https://www.rust-lang.org/tools/install or download from the web. Don't install it yet
- Download msys2. You will not be using MSVC, but instead be compiling using GNU. It does not make any differences (afaik) compared to MSVC. Download it from here: https://www.msys2.org/ and run through the setup. Msys2 should not require admin as it is copying folders. In the case that it does require it,
- Update msys2: Open msys2's UCRT or MINGW64 and run these commands:
pacman -Syu // Updates the system
pacman -S mingw-w64-x86_64-toolchain base-devel // Installs developer tools
- Go through rust setup. If it asks you to install MSVC, just enter in the option for no (or the option for GNU). continue and make everything however you wish but ensure the target is x86_64-pc-windows-gnu
- After a successful installation, create a new file under ~/.cargo/config.toml (if it doesnt exist). Enter in these lines:
[target.x86_64-pc-windows-gnu]
linker = "C:\\msys2\\mingw64\\bin\\gcc.exe"
ar = "C:\\msys2\\mingw64\\bin\\ar.exe"
Of course, change the locations to where ever you installed msys2 or keep it as it is.
- That should be all. To test if it works, create a new rust file and use rustc to compile.
Hope this helps!
This has been a very helpful guide. Thank you!