Mingw w64 build windows

mingw-w64

GCC for Windows 64 & 32 bits

Downloads

The heart of the Mingw-w64 project is headers and support libraries to run the output of GCC on Windows. Since Mingw-w64 is neither the home of GCC nor of binutils, several sets of installation packages which combine them are available.

In addition, the sources are available but most people will want to grab binaries directly..

Pre-built toolchains and packages

Version Host GCC / Mingw-w64 Version Languages Additional Software in Package Manager
Arch Linux Arch Linux 8.2.0/5.0.4 Ada, C, C++, Fortran, Obj-C, Obj-C++
Cygwin Rolling Windows 5.4.0/5.0.2 Ada, C, C++, Fortran, Obj-C 5 (bzip2, libgcrypt, libgpg-error, minizip, xz, zlib)
Debian Debian 7 (Wheezy) 4.6.3/2.0.3 Ada, C, C++, Fortran, Obj-C, Obj-C++, OCaml 2 (gdb, nsis)
Debian 8 (Jessie) 4.9.1/3.2.0
Debian 9 (Stretch) 6.3.0/5.0.0 9 (gdb, libassuan, libgcrypt, libgpg-error, libksba, libnpth, nsis, win-iconv, zlib)
Debian 10 (Buster) 8.3.0/6.0.0
Fedora Fedora 19 4.8.1/? Ada, C, C++, Fortran, Obj-C, Obj-C++
MacPorts Rolling macOS 8.2.0/5.0.4 C, C++, Fortran, Obj-C, Obj-C++ 1 (nsis)
MingW-W64-builds Rolling Windows 7.2.0/5.0.3 C, C++, Fortran 4 (gdb, libiconf, python, zlib)
Msys2 Rolling Windows 9.2.0/trunk Ada, C, C++, Fortran, Obj-C, Obj-C++, OCaml many
Ubuntu 12.04 Precise Pangolin 4.6.3/2.0.1 Ada, C, C++, Fortran, Obj-C, Obj-C++, OCaml 2 (nsis, gdb)
14.04 Trusty Tahr 4.8.2/3.1.0
14.10 Utopic Unicorn 4.9.1/3.1.0
15.04 Vivid Vervet 4.9.2/3.2.0
15.10 Wily Werewolf 4.9.2/4.0.2
16.04 Xenial Xerus 5.3.1/4.0.4 3 (nsis, gdb, zlib)
Win-Builds 1.5 Windows
Linux
4.8.3/3.3.0 C, C++

Sources

Tarballs for the mingw-w64 sources are hosted on SourceForge. The latest version from the 6.x series is 6.0.0. The latest version from the 5.x series is 5.0.4. The latest version from the 4.x series is 4.0.6. The latest version from the 3.x series is 3.3.0. Winpthreads has been merged into the main tarball as of 3.1.0.

The old wiki has instructions for building native and cross toolchains.

Details on how to get the mingw-w64 code from Git and an Git-web viewer are available on SourceForge.

Unsorted complementary list

Darwin/Mac OS X

The existing Darwin binaries have been built through buildbot in 2013 and links to them can be found on the dedicated page.

OpenSUSE

The OpenSUSE Linux distribution also has a large and well-maintained set of packages for cross-compilation.

Rubenvb

Rubenvb has built a number of toolchains including some for less common setups. They are split into two categories: toolchains targeting Win32 or Win64.

GCC with the MCF thread model

GCC with the MCF thread model is a series of x86 and x64 native toolchains built by LH_Mouse. The MCF thread model involves the mcfgthread library to provide minimum yet complete C++11 thread support. Disregarding POSIX or Windows XP compatibility, it implements (hopefully the most) efficient mutexes and condition variables that are competitive with even native slim reader/write (SRW) locks and condition variables since Windows Vista.

Store of binaries on SourceForge

A very large number of other binaries and sources are hosted in the File Release System on Sourceforge which might have what you are after.

Building MINGW-w64

. for idiots. This guide is provided for those who have no clue how to compile gcc, but still want to do it. It’s a reference, just follow the steps and you get what you want. There’s no support for special wishes 😉

Contents

Setting up the build environment

Download and install MSYS2. You will need the following packages:

  • MSYS2 (version 20180531)
  • Recent mingw-w64 32 bit Toolchain (here)

Download all packages and install them into c:\MSYS32. Extract Toolchain to the /mingw32/ folder inside.

pacman -S —needed make texinfo diffutils

(If installing make makes problems, remove the files it laments about already being existent)

Getting the sources

Download all the sources into subfolders of /src

  • binutils (version 2.32) -> /src/binutils
  • gcc (version 8.3.0) -> /src/gcc
  • mingw-w64 v6.0.0 (here) -> /src/mingw-w64
  • MPFR (version 4.0.2) -> /src/gcc/mpfr
  • GMP (version 6.1.2) -> /src/gcc/gmp
  • MPC (version 1.1.0) -> /src/gcc/mpc

Building

  • USE THE MINGW32.EXE. Otherwise the host= and build= parameters are set to some msys2 environment and not the one we expect.
  • the -jX parameter added to make speeds up the build processes by using mutiple threads to build on more than one CPU core. Use your amout of cores + 1 as number instead of the X.

Optionally set buildflags:

Building binutils

Create a build subdirectory for binutils:

From the build directory run the binutils configure script:

Now build the whole stuff.

Finally install it into the designated directory.

Building the mingw-w64 headers

Create a build directory.

Run the configure script

Copy the /RosBE/x86_64-w64-mingw32 (64 bit) or /RosBE/i686-w64-mingw32 (32 bit) directory to /RosBE/mingw.

Add it to the PATH variable.

Building gcc-core

Enter into the build directory:

Now run the configure script:

Compile the gcc-core

Building the crt

Create a build directory.

Run the configure script

Copy the /RosBE/x86_64-w64-mingw32 (64 bit) or /RosBE/i686-w64-mingw32 (32 bit) directory to /RosBE/mingw.

Building the rest of gcc

Enter into the gcc build directory.

And compile the rest.

Stripping the binaries

CD to the RosBE directory and execute these

Mingw w64 build windows

The scripts provided by the MinGW-W64 project[1] are designed for building the dual-target(i686/x86_64) MinGW-W64 compiler for i686/x86_64 hosts.

The scripts are distributed under the ‘BSD 3’ license[2].

In order to use the scripts provided by the MinGW-W64 project it is needed:

Windows-64bit or Linux + Wine-64bit

Get the scripts into /home/ /mingw-builds : cd && git clone

(see the diff between the ‘master’ and ‘develop’ branches, maybe you need the ‘develop’ branch exactly)

In the MSYS2 file structure delete the /MinGW directory.

Delete the paths pointing to any preinstalled MinGW from the PATH environment variable.

Go into the MinGW-builds root directory. cd && cd mingw-builds

For more options run: «./build —help»

  1. Run:
  • ./build —mode=gcc-4.8.1 —arch=i686 for building i686-MinGW-w64
  • ./build —mode=gcc-4.8.1 —arch=x86_64 for building x86_64-MinGW-w64
  • ./build —mode=gcc-4.8.1 —arch=x86_64 —preload for preload sources and building x86_64-MinGW-w64
  • ./build —mode=gcc-4.8.1 —arch=i686 —exceptions=dwarf for building i686-MinGW-w64 with DWARF exception handling

For example, during the process of building of the i686-gcc-4.7.2 will be created the following directories:

And the sources directory: /src

The archives with the built MinGW will be created in /archives/

At the moment, successfully building the following versions:

Builds also contains patches for building Python 2.7.9 and 3.4.3 versions for support gdb pretty printers. Big thanks for these patches to:

About

Scripts for building the dual-target(32 & 64 bit) MinGW-W64 compilers for 32 and 64 bit Windows

Читайте также:  Windows focus was lost
Оцените статью