Why do I need Microsoft C++ build tools?

Not really. MinGW is a port of the GNU toolchain that targets Windows, and the Win32 API, for writing Windows software. The reason MinGW and MSVC are separate targets is because MinGW does a not-that-great job of being a Windows toolchain. It's incompatible with MSVC import libraries, the import libraries is does provide are old (and in many cases, flat-out wrong), and it doesn't use the same runtime libraries as MSVC code. I'm also not sure if GCC is ABI-compatible with MSVC; I know that clang isn't.

The practical upshot of this is that, barring simple cases, MSVC and MinGW-compiled code, whilst both running on Windows through Win32, aren't entirely compatible with one another. So if you're linking against libraries built with MSVC, you have to use the MSVC backend, and vice-versa for libraries built with MinGW.

The "UNIX-y environment" toolchain on Windows is Cygwin, which does everything it can to paper over Win32 to create as UNIX-y an environment as it can, to make it easier to build UNIX software for Windows. MSYS is a fork (?) of Cygwin that provides a UNIX-y environment for building Windows software... and for building UNIX software for itself.

The above is a complete pig's breakfast of a mess, which is why I try to avoid mentioning it because almost none of it is important for Rust users beyond: "there's MinGW and MSVC, just use MSVC unless you can't".

8 Likes