:term:`mingw-w64` is a fork of the :term:`mingw` project.
To date, numpy and scipy have used versions of the mingw compilers to create 32-bit binary distributions on Windows. mingw-w64 has some major advantages over mingw, including:
- support for compiling 64-bit extensions (as well as 32-bit);
- large file support;
- winpthread pthreads implementation, MIT licenced;
- more active development.
The mingw-w64 project releases the supporting files to allow the standard :term:`gcc` distribution to compile code that can:
- make many standard Windows API calls;
- link against standard :term:`MSCRT` :term:`runtime library` files.
Among the files the project provides are:
mingw-w64-headers
|--| header files specific to the Windows implementation.mingw-w64-crt
|--| code for C / C++ runtime libraries (providing functions not directly or reliably available from the MSCRT);mingw-w64-libraries
|--| libraries for using POSIX threads (winpthreads), working with MSVC symbol name mangling (libmangle), Windows store compatibility (winstorecompat), structured exception handling (pseh);mingw-w64-tools
|--| tools for: generating DLL export definition (def
) files (gendef); working with the Microsoft Interface Description Language (genidl, widl); modifying `PE`_ flags in Windows executable files (genpeimg).
The project has official source releases on sourceforge: see `mingw-w64 source releases`_.
In order to use mingw-w64 implementations to compile real code, you will need a mingw-w64 compiler toolchain.
To build software with mingw-w64 you will likely need:
- the compiler (gcc, compiled from standard gcc sources), augumented with the mingw-w64 extensions, including Windows-specific headers and runtime libraries;
- a build of the GNU :term:`binutils` tools, containing utility programs such
as
ld
,ar
,dlltool
.
The mingw-w64 compiler can be built with different ways of handling C++ exceptions. See `mingw-w64 exception handling`_ and `SO post on mingw-w64 exception handling`_ for background.
The exception handling modes are:
- Dwarf2: only supported building for 32-bit Windows targets;
- setjmp / longjmp (SJLJ): "much slower than Dwarf2", but compatible on 32 and 64 bits;
- `Structured exception handling`_ (SEH): the standard MSVC exception handling mechanism, supported in 64-bit GCC since version 4.8. SEH still not supported for 32-bit targets.
The mingw-w64 compiler can also be built with different threading models. The options are:
- POSIX threads (full C++11/C11 threading features);
- win32 threads (No C++11 multithreading features).
See these SO posts:
In practice, for building software, you will usually want a wider range of
tools than just the compiler and binutils utilities. In particular you will
probably want tools like the bash
shell, make
, and the GNU build
system.
MSYS2_ provides these. msys2 is the successor of msys. Msys2 is necessary as environment for the mingw build process on Windows. - http://sourceforge.net/p/msys2/wiki/MSYS2%20installation/
'recommended' builds are available from the mingw-builds project via http://mingw-w64.sourceforge.net/download.php |--| for example:
These are common combinations of exception and thread models. You can find other combinations as well. Exception handling affects C++ development. Don't ever link object code with different types of exception and/or thread handling!
Threads concerning the question 'where to find mingw-w64 builds':
- http://article.gmane.org/gmane.comp.gnu.mingw.w64.general/7700
- http://article.gmane.org/gmane.comp.gnu.mingw.w64.general/8484
Recent mingw-w64 based tools and library packages together with sources and patches are available from archlinux as well as from the msys2 maintainers.
- http://sourceforge.net/projects/mingw-w64-archlinux/files/ (i686: Sjlj | x86_64: SEH)
- http://sourceforge.net/projects/msys2/files/REPOS/MINGW/ (i686: Dwarf | x86_64: SEH)
See also this mingw-w64 writeup for Qt.
"mingw-builds" is a set of scripts and patches for compiling the GCC toolchain under Windows with the help of msys2 POSIX environment - https://github.com/niXman/mingw-builds/tree/develop recent 'mingw-builds' GCC toolchains can be downloaded from the mingw-w64 sf.net site: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/