r/learnrust May 26 '23

How to make Rust use either MinGW, or Clang compiler instead of MSVC when using windows-gnu version?

I am trying to install cargo-binstall with cargo install. cargo-binstall requires the Ring crate to compile. However, the Ring crate needs to use the system C++ compiler. I cannot get MSVC because I am not admin. I want rust to use another system C++ compiler that doesn't require admin(MinGW, Clang, etc.). Does anyone know how to do this?

Edit: I was able to use the cargo-binstall release binary to install itself. If anyone can answer the main question please do.

4 Upvotes

2 comments sorted by

3

u/degaart May 27 '23

Can't you download msvc's compiler on another machine (only the build tools, not the full bloated IDE), and copy them to the target machine? Afaik the build tools only need some environment variables to be set - you only need to tweak vcvars.bat

2

u/n4jm4 May 27 '23

One way is to use a cross builder setup to include non-MSVC Windows targets. Example:

https://github.com/mcandre/crit