- MinGW package guidelines
- Contents
- Package naming
- Packaging
- Examples
- Downloads
- Pre-built toolchains and packages
- Arch Linux
- Ubuntu
- Cygwin
- Debian
- Fedora
- LLVM-MinGW
- MacPorts
- Mingw-builds
- MSYS2
- Win-Builds
- Sources
- Unsorted complementary list
- Darwin/Mac OS X
- OpenSUSE
- Rubenvb
- GCC with the MCF thread model
- Store of binaries on SourceForge
- how do I install both mingw32 and mingw64 on Linux or MacOS?
- 4 Answers 4
- MinGW-w64 Arch Linux
- MinGW-w64 Repository for Arch Linux
- Brought to you by: ant32, nic96
- Welcome to Arch Linux Mingw-w64 Repository
MinGW package guidelines
This page expains how to write PKGBUILDs for software running on Windows using GCC. There are two options to build software for Windows on Linux:
- mingw-w64: provides 32 and 64-bit toolchains with secure crt, Vista+ API, DDK (ReactOS), and DirectX (WINE) support. For a full list of supported features and differences with the old MinGW.org, see here. Available from the official repositories by installing mingw-w64-gcc .
- MinGW: provides 32-bit toolchains with limited DirectX support. It also suffers from long-standing breakage in the implementation of thread-local storage and the floating point library support. It has been removed from the official repositories and the AUR.
Contents
Package naming
A package for mingw-w64 should be named mingw-w64-pkgname . If a static variant of the package is being built, suffix the package name with -static (see below for the cases where this is necessary).
Packaging
Packaging for cross platform packages can be fairly tricky as there are many different build systems and low-level quirks. Take a note of the following things though:
- always add mingw-w64-crt to depends , unless it depends on another package which implicitly depends on it
- always add mingw-w64-gcc to makedepends , unless using mingw-w64-configureAUR or mingw-w64-cmakeAUR
- always add !strip , staticlibs and !buildflags to options
- always use the original pkgdesc and append (mingw-w64) to the end of pkgdesc
- always use and follow the original pkgver of the official package
- always build both 32-bit and 64-bit versions of libraries
- always put all stuff under the /usr/i686-w64-mingw32 and /usr/x86_64-w64-mingw32 prefix
- always use any as the architecture (except the package contains executables which must run on the build system)
- always build both shared and static libraries
- autotools-based projects often support building both in one go, when using mingw-w64-configureAUR shared and static libraries are both enabled
- if the build system or project does not support this, build both separately
- if the shared and static build conflict (e.g. because headers or CMake configuration files differ) consider installing static libraries into /usr/i686-w64-mingw32/static and /usr/x86_64-w64-mingw32/static
- for bigger projects, consider creating a separate -static package
- consider removing unneeded documentation ( rm -r $pkgdir/usr/i686-w64-mingw32/share/
, rm -r $pkgdir/usr/x86_64-w64-mingw32/share/ ) - consider using mingw-w64-configureAUR for building with configure scripts
- consider using mingw-w64-cmakeAUR for building with CMake
- consider using mingw-w64-mesonAUR for building with Meson
- consider using mingw-w64-makeAUR for building with raw Makefiles
- consider using mingw-w64-qt5-baseAUR for building with QMake
- consider explicitly stripping symbols with $<_arch>-strip in package() ‘s for-loop as demonstrated in the below PKGBUILD examples.
- consider using the find command to iterate over $pkgdir since not all DLLs, static libraries, or executables may reside in their appropriate locations.
- if the binary is a DLL, use $<_arch>-strip —strip-unneeded *.dll
- if the binary is a static lib, use $<_arch>-strip -g *.a
- consider using the find command to iterate over $pkgdir since not all DLLs, static libraries, or executables may reside in their appropriate locations.
- if a package is modular (requires certain build dependencies, but said dependencies are optional to the end user) add these to makedepends and optdepends . Be sure to subtract them from depends if updating an existing package. Example of this in use: mingw-w64-rubyAUR [broken link: package not found] , mingw-w64-allegroAUR
- if a package installs a $pkgdir/usr/$<_arch>/bin/*-config script, symlink it to $pkgdir/usr/bin/$<_arch>-*-config
- if a package uses autoconf, explicitly set —build=»$CHOST» for configure to workaround autoconf bug #108405 or use mingw-w64-configureAUR
As mentioned above, the files should all be installed into /usr/i686-w64-mingw32 and /usr/x86_64-w64-mingw32 . Specifically, all DLLs should be put into /usr/*-w64-mingw32/bin as they are dynamic libraries needed at runtime. Their corresponding .dll.a files should go into /usr/*-w64-mingw32/lib . Please delete any unnecessary documentation and perhaps other files from /usr/share . Cross-compilations packages are not meant for the user but only for the compiler and binary distribution, and as such you should try to make them as small as possible.
Always try to match the pkgver in your mingw-w64 packages to the pkgver of the corresponding regular packages in the official Arch Linux repos (not the testing repos). This ensures that the cross-compiled software works exactly the same way on Windows without any unexpected bugs. If packages in Arch are out-of-date, there usually is a good reason and you should still follow the Arch version instead of using the most recent upstream release. If the corresponding native package is in the AUR, you need not follow this version policy, as many AUR packages are often orphaned or left unmaintained.
Examples
The following examples will try to cover some of the most common conventions and build systems.
Источник
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 | 11.2.0/9.0.0 | Ada, C, C++, Fortran, Obj-C, Obj-C++ | many | |
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++ | 149+ | |
LLVM-MinGW | 20210423 | Windows, Linux | LLVM 12.0.0/trunk | C, C++ | make |
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++ | 91+ |
Arch Linux
Ubuntu
Installation: through integrated package manager.
Cygwin
Cygwin is a Unix-like environment and command-line interface for Microsoft Windows. Its core is the cygwin1.dll library which provides POSIX functionality on top of the Win32 API. It can be used as a build environment which targets Windows directly and for which output doesn’t depend on cygwin1.dll.
Installation is done through cygwin’s package manager: setup.exe.
As part of the numerous packages in cygwin, there are cross-compilation toolchains which target both 32 bits and 64 bits; their names start with “mingw64-”.
Once they are installed, they should be used according to the general cross-compilation approach.
Debian
Installation: through integrated package manager.
Fedora
Installation: through integrated package manager.
LLVM-MinGW
LLVM-MinGW is a toolchain built with Clang, LLD, libc++, targeting i686, x86_64, arm and aarch64 (ARM64), with releases both for running as a cross compiler from Linux and for running on Windows. It supports Address Sanitizer, Undefined Behaviour Sanitizer, and generating debug info in PDB format.
MacPorts
To install just the 32-bit or just 64-bit compiler with dependencies, use:
A shortcut to install both:
Mingw-builds
MSYS2
Win-Builds
Win-builds is a cross-platform project that makes building for Windows easy. It supports building from both Windows and Linux systems and provides many pre-built libraries which can be installed through a graphical package manager.
It aims for stability while still providing recent versions of software packages.
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.
Источник
how do I install both mingw32 and mingw64 on Linux or MacOS?
I’m having trouble installing both mingw32 and mingw64 on Linux or MacOS. I’ve tried many different package repositories and multiple versions of Linux. I’m happy to use anything.
4 Answers 4
On Ubuntu, you can get going in many cases with «apt-get install gcc-mingw32»
If you need to install both the 64-bit and 32-bit mingw compilers, try this:
For 64-bit build systems:
For 32-bit build systems:
On Fedora, you can install mingw32 using standard yum. To install mingw64, follow the instructions at:
Best bet for cross-compiling seems to be Fedora, which gives you both mingw32 and mingw64:
sudo yum install mingw32-gcc-c++
I haven’t been able to find a 64-bit cross-compiler for Mac.
Fedora has a very nice mingw32 cross compiler framework with lots of pre-compiled libraries. The packages are all included in the official package repository and it’s just the matter of running ‘yum install mingw32-gcc’ to set the compiler up. See the Fedora MinGW project page for more information.
However, the official packages currently only support the 32 bit Windows target. To lift that restriction, there is work underway and a temporary repository set up with mingw32, mingw64, and OS X cross compilers. See https://fedoraproject.org/wiki/MinGW/CrossCompilerFramework for more info.
I take it you want to cross-compile to both win32 and win64. Current Debian testing can help you there with the gcc-mingw-w64 package. Drawback is that shared gcc libraries (=> cross-DLL exception support etc.) is currently disabled.
Источник
MinGW-w64 Arch Linux
MinGW-w64 Repository for Arch Linux
Brought to you by: ant32, nic96
Welcome to Arch Linux Mingw-w64 Repository
The testing packages are here
Old packges are archived here
Logs can be found here
The scripts used to build these packages can be found at https://github.com/ant32/amr
To use this repo add the following lines to /etc/pacman.conf
You may also wish to use the testing repo. This repo is basically where the stuff goes in during the auto compilation.
These are currently the only mingw-w64 packages that I don’t have in the repo that are in AUR and not orphaned (as of Nov 26, 2013).
- mingw-w32-bin — by itself a toolchain
- mingw-w64-bin — by itself a toolchain
- mingw-w64-bin_i686 — by itself a toolchain
- mingw-w64-crt-svn — The stable crt is now working
- mingw-w64-headers-svn — stable headers are now working
- mingw-w64-microhttpd — requres mingw-w64-plibc
- mingw-w64-plibc — does not compile
- mingw-w64-poppler — does not compile
- mingw-w64-pthreads — not compatible with toolchain
- mingw-w64-tox-git — does not compile
- mingw-w64-venom-git *- does not compile
- mingw-w64-winpthreads-svn — stable winpthreads are now working
I am currently using a 1GB/30GB VM from digitalocean
Not all packages compile with 1GB of ram so I created a 512MB swap file.
Источник