There are three main versions of the MingW:
1- mingw32-gcc.exe the compiler will build 32-bit applications on 32-bit systems.
2- i686-w64-mingw32-gcc.exe the compiler will build 32-bit applications on 64-bit systems.
3- x86_64-w64-mingw32-gcc.exe the compiler will build 64-bit applications on 64-bit systems.
of course, more details arise once you read the documentation. ensure you are installing the correct version.
Answer from eliahonader on Stack OverflowThere are three main versions of the MingW:
1- mingw32-gcc.exe the compiler will build 32-bit applications on 32-bit systems.
2- i686-w64-mingw32-gcc.exe the compiler will build 32-bit applications on 64-bit systems.
3- x86_64-w64-mingw32-gcc.exe the compiler will build 64-bit applications on 64-bit systems.
of course, more details arise once you read the documentation. ensure you are installing the correct version.
x86_64-w64-mingw32-gcc.exe is part of the MinGW-w64 project. This is different to the MinGW project. So you installed the wrong thing.
Here is the homepage for MinGW-w64. For a self-installer, follow the "Mingw-builds" link from the download page.
Videos
TLDR;
Besides installing a cross target with rustup you need to install an actual cross linker and tell cargo about it using cargo config file or an environment variable
It seems you are attempting to cross compile your package. you can read here more about cross compilation; In a nutshell compiler is a program that takes your text source code and produces something the your operating system and cpu can understand.
When you are building software for the platform you are developing on, it's all nice. You have all the tools but when you want to target another platform or os, you need a compiler that is produced to work on your machine but outputs a binary that is supposed to work on the target platform/os.
So, In your case you need to install a cross toolchain that for mac for mingw target because rust does not have a cross linker itself. Once you get a cross toolchain all you need to do is to tell cargo how to find it.
Here is a project aims to make cross compilation less painful.
I also strongly advise you to read the cargo book
here you can see one of the ways of telling cargo about the cross linker
another way is to use an environment variable (which I like better and easier to use with makefiles)
and below you can see an example of that from one of my makefiles
and Again the cargo book refers to it 
Overall cross compiling is painful it took me quite some time to understand the mechanics of it but it was worth it instead of copy pasting commands I found on the blogs. I also feel like it lacks severe documentation. Cargo book doesn't tell you anything about finding a linker assumes you know this already and pictures cross compiling as something just work out of box after installing a target toolchain with rustup.
For those who work on MacOS (after installing MacPorts) :
sudo port install x86_64-w64-mingw32-gcc
For those who have the same problem on Ubuntu:
sudo apt-get install mingw-w64
This should solve your issue. The cross compiler is not installed by rustup and thus must be installed separately.
Why is this Mingw-w64 package so large?
Because mingw-w64 is a meta-package providing the MinGW-w64 toolchain with a C and C++ compiler targeting all supported targets. Currently this involves four different backends (32- and 64-bit, combined with POSIX and Windows threading models).
If you don’t need all that, you can ask apt to only install the compiler you’re interested in, and you’ll end up with a smaller set of packages:
apt install gcc-mingw-w64-x86-64
This will install the 64-bit toolchain, without g++. That’s still around 300MiB...
The next version of Debian (and Ubuntu 20.04) provide finer granularity, so you can specify only one of the threading models:
apt install gcc-mingw-w64-x86-64-posix
Yes, if you don't need the full suite, you can choose to install a specific part of it. Installing gcc-mingw-w64 will give you everything needed by C, but exclude support for C++. This might be perfect for you.
If you want to bring in less, you could bring in only gcc-mingw-w64-x86-64 to allow you to compile for x86-64 architectures only. That will exclude any i686 support. If you are trying to compile with posix-threads only on Debian bullseye and above, you could isolate this further to gcc-mingw-w64-i686-posix.
Note that even if you go as specific as gcc-mingw-w64-i686-posix, you'll still get the *-runtime, -base, binutils-* and *-dev packages.
If your plan is not to compile, but rather just use something like /usr/bin/x86_64-w64-mingw32-elfedit, then you could simply install binutils-mingw-w64-x86-64. You can use apt-file list <package> to see the files each package provides.
The dependency tree on Debian bullseye (11) and Ubuntu 20.04 looks like this:
mingw-w64
|- gcc-mingw-w64
| |- gcc-mingw-w64-i686
| | |- gcc-mingw-w64-i686-posix
| | | |- gcc-mingw-w64-i686-posix-runtime
| | | |- gcc-mingw-w64-base
| | | |- binutils-mingw-w64-i686
| | | `- mingw-w64-i686-dev
| | `- gcc-mingw-w64-i686-win32
| | |- gcc-mingw-w64-i686-win32-runtime
| | |- gcc-mingw-w64-base
| | |- binutils-mingw-w64-i686
| | `- mingw-w64-i686-dev
| `- gcc-mingw-w64-x86-64
| |- gcc-mingw-w64-x86-64-posix
| | |- gcc-mingw-w64-x86-64-posix-runtime
| | |- gcc-mingw-w64-base
| | |- binutils-mingw-w64-x86-64
| | `- mingw-w64-x86-64-dev
| `- gcc-mingw-w64-x86-64-win32
| |- gcc-mingw-w64-x86-64-win32-runtime
| |- gcc-mingw-w64-base
| |- binutils-mingw-w64-x86-64
| `- mingw-w64-x86-64-dev
`- g++-mingw-w64
|- g++-mingw-w64-i686
| |- g++-mingw-w64-i686-posix
| | |- gcc-mingw-w64-i686-posix
| | |- gcc-mingw-w64-i686-posix-runtime
| | `- gcc-mingw-w64-base
| `- g++-mingw-w64-i686-win32
| |- gcc-mingw-w64-i686-win32
| |- gcc-mingw-w64-i686-win32-runtime
| `- gcc-mingw-w64-base
`- g++-mingw-w64-x86-64
|- g++-mingw-w64-x86-64-posix
| |- gcc-mingw-w64-x86-64-posix
| |- gcc-mingw-w64-x86-64-posix-runtime
| `- gcc-mingw-w64-base
`- g++-mingw-w64-x86-64-win32
|- gcc-mingw-w64-x86-64-win32
|- gcc-mingw-w64-x86-64-win32-runtime
`- gcc-mingw-w64-base
Bonus: The maintainer for mingw frequents this site. You might get a better answer from him.