Opened 5 years ago

Closed 2 years ago

Last modified 2 years ago

#40174 closed request (fixed)

MinGW-w64: add win64 cross-compiler

Reported by: sam.halliday@… Owned by: mojca (Mojca Miklavec)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: landonf@…, hippallium-macports@…, rpspringuel (Br. Samuel Springuel)
Port: mingw-w64 i686-w64-mingw32-gcc x86_64-w64-mingw32-gcc

Description (last modified by mojca (Mojca Miklavec))

the MingW cross-compiler for windows is quite old and there is currently no cross-compiler for Windows 64. Packages for both would be fantastic!

http://mingw-w64.sourceforge.net/

Upstream build instructions:

Scripts to build MinGW-w64 from scratch:

Instructions about building a cross toolchain:

Initial drafts can be found under users/mojca/ports/cross).

Ports

The ports have to be compiled in the following order:

  • {i686,x86_64}-w64-mingw32-binutils (DONE)
    • (no dependencies)
  • {i686,x86_64}-w64-mingw32-headers (DONE)
    • (no dependencies)
  • gmp, mpfr, libmpc (native ports already packaged by MacPorts)
  • cloog, ppl (might be worth looking into)
  • {i686,x86_64}-w64-mingw32-gcc (possibly rename)
    • gcc compiler
    • dependencies:
      • {i686,x86_64}-w64-mingw32-binutils
      • {i686,x86_64}-w64-mingw32-headers
      • {i686,x86_64}-w64-mingw32-gcc
      • gmp, mpfr, libmpc
      • libiconv, zlib
    • the first stage compiles (this is a standalone gcc, it won't actually be able to link executables, but it is already suitable to compile the CRT)
  • {i686,x86_64}-w64-mingw32-crt (DONE)
    • dependencies:
      • {i686,x86_64}-w64-mingw32-binutils
      • {i686,x86_64}-w64-mingw32-headers
      • {i686,x86_64}-w64-mingw32-gcc (either first stage or any later stage)
    • make sure that all the file are where expected
  • {i686,x86_64}-w64-mingw32-libgcc
    • same sources as the gcc compiler; only a different target (make all-target-libgcc && make install-target-libgcc)
    • when a compiler already exists, one could build both gcc and libgcc at the same time
    • files provided by the gcc port should be removed
    • dependencies:
      • {i686,x86_64}-w64-mingw32-crt
      • {i686,x86_64}-w64-mingw32-gcc (either first stage or any later stage)
  • pthreads-win32
    • dependencies:
      • {i686,x86_64}-w64-mingw32-libgcc (or full compiler)
  • {i686,x86_64}-w64-mingw32-all(?) (second stage of gcc compiler)
    • same sources as the gcc compiler; only a different target (make && make install)
    • dependencies:
      • pthreads-win32
      • {i686,x86_64}-w64-mingw32-libgcc

Things to do

  • fix layout of individual packages (folders where files are installed)

Further challenges

  • on top of C and C++ also support Ada, Fortran, ObjC, ObjC++ (--enable-languages=c,c++,objc,obj-c++,ada,fortran)
  • support clang
  • figure out where stdlibc++ should be located on Windows (is it possible to build it statically?)

Change History (15)

comment:1 Changed 5 years ago by sam.halliday@…

this should be against i386-mingw32-gcc (but I can't seem to change that anymore)

comment:2 Changed 5 years ago by cooljeanius (Eric Gallager)

As far as the "being quite old" part, that's #31578... as for the x86_64 support part, I think I've seen a ticket for that, too, but I'm still looking for that...

comment:3 Changed 5 years ago by mf2k (Frank Schima)

Owner: changed from macports-tickets@… to landonf@…
Port: i386-mingw32-gcc added
Type: updateenhancement
Version: 2.2.0

in the future, please Cc the port maintainers (port info --maintainers).

comment:4 Changed 5 years ago by sam.halliday@…

workaround is to download the mingw64 binaries for i686-darwin from sourceforge.

comment:5 Changed 5 years ago by mojca (Mojca Miklavec)

Cc: mojca@… added

Cc Me!

comment:6 Changed 5 years ago by mojca (Mojca Miklavec)

Description: modified (diff)
Port: mingw-w64 added
Summary: upgrade mingw and add win64 cross-compilerMinGW-w64: add win64 cross-compiler
Type: enhancementrequest

comment:7 Changed 5 years ago by mojca (Mojca Miklavec)

I started playing with mingw-w64 (you can check users/mojca/ports/cross), but these are still very basic attempts to get something working. I'm still learning.

comment:8 Changed 4 years ago by hippallium-macports@…

Cc: hippallium-macports@… added

Cc Me!

comment:9 Changed 3 years ago by mojca (Mojca Miklavec)

Cc: landonf@… added; mojca@… removed
Description: modified (diff)
Owner: changed from landonf@… to mojca@…
Port: i686-w64-mingw32-gcc x86_64-w64-mingw32-gcc added; i386-mingw32-gcc removed

comment:10 Changed 3 years ago by rpspringuel (Br. Samuel Springuel)

Cc: rpspringuel@… added

Cc Me!

comment:11 Changed 2 years ago by mojca (Mojca Miklavec)

In 07d0ce54/macports-ports:

{i686|x86_64}-w64-mingw32-binutils: new ports

Closes: #13606
See: #40174

comment:12 Changed 2 years ago by mojca (Mojca Miklavec)

Resolution: fixed
Status: newclosed

In 0caa2d2/macports-ports:

mingw-w64: new cross-compiler for Windows

Following:

  • ${arch}-w64-mingw32-binutils

this completes the cross-compiler for Windows
with the following subports:

  • ${arch}-w64-mingw32-headers
  • ${arch}-w64-mingw32-crt
  • ${arch}-w64-mingw32-gcc-bootstrap
  • ${arch}-w64-mingw32-gcc

with arch=i686|x86_64.

The first two ports come from the MinGW-w64 project, while GCC is compiled from
original GCC sources. The *-gcc-bootstrap port is needed to compile *-crt and
*-gcc itself.

Not (yet?) implemented:

  • support for Ada
  • support for pthreads-win32 & OpenMP
  • support for parallel installation of multiple GCC compilers

Closes: #40174

comment:13 Changed 2 years ago by mojca (Mojca Miklavec)

See also #53061 with suggestion to remove i386-mingw.

comment:14 Changed 2 years ago by mojca (Mojca Miklavec)

In e2e60373/macports-ports:

{i686|x86_64}-w64-mingw32-binutils: new ports

Closes: #13606
See: #40174

comment:15 Changed 2 years ago by mojca (Mojca Miklavec)

In f03d761/macports-ports:

mingw-w64: new cross-compiler for Windows

Following:

  • ${arch}-w64-mingw32-binutils

this completes the cross-compiler for Windows
with the following subports:

  • ${arch}-w64-mingw32-headers
  • ${arch}-w64-mingw32-crt
  • ${arch}-w64-mingw32-gcc-bootstrap
  • ${arch}-w64-mingw32-gcc

with arch=i686|x86_64.

The first two ports come from the MinGW-w64 project, while GCC is compiled from
original GCC sources. The *-gcc-bootstrap port is needed to compile *-crt and
*-gcc itself.

Not (yet?) implemented:

  • support for Ada
  • support for pthreads-win32 & OpenMP
  • support for parallel installation of multiple GCC compilers

Closes: #40174

Note: See TracTickets for help on using tickets.