Some people are not happy with the dependency on Cygwin, either due to
the performance reasons outlined above or due to its fairly viral GPL
licence. MinGW tries to plug this gap in the market, providing the
following:
- a native port of the GNU toolchain to Windows, including GCC, make,
etc. These are full-blown windows applications with no other
dependencies;
- the MinGW run-time: headers and lib files that allow compiling
against the Microsoft C Standard Library;
- a set of Windows API headers required to compile code against the
Windows API.
With these three things one can build native Windows applications that
do not rely on POSIX at all (they can, of course, rely on any POSIX
functionality Windows may offer directly).
As explained previously, many applications require a POSIX environment
on which to build; for instance they may make use of shell scripts so
bash is a requirement. To aid in this department, MinGW comes with
MSYS, which is effectively an extremely cut-down fork of Cygwin that
contains a very minimalist environment with bash, ls and so
on. While it may work out of the box for simple use cases, you may
find its a bit too basic for non-trivial applications. For instance we
found that the version of tar supplied didn't support 32-bit GIDs,
causing a lot of spurious warnings. If a basic package like tar,
which is trivially used for installing software, must be tinkered with
in order to work you can imagine the difficulties in compiling large
and complex applications. This is probably not a problem for the
typical low-level MinGW user, probably accustomed to embedded
development, but it makes it slightly less accessible to the casual
developer not interested in the guts of the implementation.
As you probably already guessed, nothing stops you from using MinGW
from within Cygwin; in fact, it's available as a package. Doing this
gives you the advantages of a full-blown POSIX environment in which to
build, rather than the spartan MSYS, whilst still allowing you to
generate binaries that do not require Cygwin to run. If you do not
want to spend time setting up basic environmental details then Cygwin
is the right choice for a key-in-hand solution for a UNIX environment
on Windows.
More interesting still, you can run MinGW directly on Linux. Once GCC
was taught how to generate binaries for the Windows platform, the next
logical step was to allow it to cross-compile these binaries in
Linux. This basically means that a MinGW version of GCC is available
on your Linux distribution as an ELF binary which is able to generate
PE binaries that can be executed on Windows. In this case you won't
need MSYS as Linux already provides you with a POSIX environment in
which to build. To put things slightly more technically, you can use
Linux as both the build and host system, and generate binaries
that target Windows.
Finally, a word about MinGW-w64. Originally MinGW only targeted
Windows 32-bit - hence why you may see MinGW32 in a lot of places; as
64-bit became more popular, a compiler for it was required - that's
where MinGW-w64 came in. These days it provides both 32-bit and 64-bit
compilers and it distinguishes itself by both covering more of the
Windows API and providing really recent GCC releases. For instance,
snapshots of GCC 4.8 are already available from their download site.