Features/Mingw-w64 cross compiler

From FedoraProject

< Features
Revision as of 15:08, 29 January 2011 by Epienbro (Talk | contribs)

Jump to: navigation, search

Contents

Cross Compiler Framework

Summary

Introduce a set of packages and RPM macros to help building binaries for multiple targets. Initially, support for Win32 and Win64 will be added, but adding support for other targets (like Mac OS X) in the future will become quite easy

Owner

  • Email: epienbro@fedoraproject.org
  • IRC: epienbro @ irc.freenode.net #fedora-mingw
  • Mailing list: mingw@lists.fedoraproject.org

Current status

  • Targeted release: Fedora 15
  • Last updated: Jan 29 2011
  • Percentage of completion: 40%

Detailed Description

Several Fedora releases ago support was added to build binaries for the Win32 target using the mingw.org toolchain (Features/Windows_cross_compiler). At the moment there are about 96 packages in Fedora which make use of this toolchain (the mingw32-* packages). There has been some demand to also add support for building binaries for the Win64 target as well as the Mac OS X target. In order to build binaries for the Win64 target we have to switch from the mingw.org toolchain to the (much better maintained and complete) mingw-w64 toolchain

In the past there has been a successful attempt to building binaries for the Mac OS X on a Fedora host. However, it but can't be added to Fedora at the moment because some binary blobs were used and several file are licensed under a forbidden license. If we really want to have Mac OS X support in Fedora in the future we should try to get these issues resolved first

In order to make it easy for packagers to build binaries for multiple targets (from a single source rpm) several RPM macros have been developed. These RPM macros are an attempt to reduce the amount of duplication of .spec files to a minimum and are bundled in the cross-filesystem package (which will replace mingw32-filesystem). All these macros are explained at the MinGW/CrossCompilerFramework page. Several RPM packages have been developed like cross-binutils, cross-gcc, mingw-headers and mingw-crt containing all pieces belonging to the mingw-w64 toolchain (which can build binaries for both Win32 as well as Win64)

With this framework we'll also be building binaries for the Win32 target using the mingw-w64 toolchain (instead of the mingw.org one). Most packages compile fine out of the box against the mingw-w64 toolchain. All packages which require some patching have been identified and have already been made operational in a testing repository

Benefit to Fedora

This feature makes it easier for packagers to build packages for multiple targets (Win32+Win64 initially). Regular developers can also use the tools from this framework to build binaries (and test these using wine) for multiple targets

Scope

Before this feature can land in Fedora several tasks have to be done:

  • Develop a set of RPM macros to reduce duplication in .spec files done
  • Package the mingw-w64 toolchain done
  • Rebuild all mingw32-* packages against the mingw-w64 toolchain done
  • Patch all mingw32-* packages which failed to build against the mingw-w64 toolchain done
  • Port the most important mingw32-* packages to use the new set of RPM macros so that binaries get build for Win32 and Win64 done
  • Package the darwinx (Mac OS X) toolchain and integrate it in a separate tree done
  • Make sure that the mingw32-* packages which were ported earlier can also build with darwinx support with minimal changes done
  • Publish testing repositories for both the Win32+Win64 tree and the Win32+Win64+Darwinx tree (the packages from the first tree are targeted for Fedora 15) done
  • Write a porting guide done
  • Rewrite the Fedora MinGW packaging guidelines
  • Let the updated packaging guidelines be approved
  • Put the 5 toolchain packages (cross-filesystem, cross-binutils, cross-gcc, mingw-headers and mingw-crt) up for review
  • Have FE-Legal approve the use of the mingw-w64 toolchain
  • Once these 5 packages have been approved, import the packages, bootstrap the toolchain and rebuild all mingw32-* packages in a separate Koji buildroot
  • Port the individual mingw32-* packages to use this new framework (not required to be completed for Fedora 15)

Most of the steps required to get this in Fedora are also explained at the roadmap page

How To Test

Until the packages belonging to the cross compiler framework are imported in Fedora people interested can test this feature using a testing repository. Details about this can be found at the testing repository page. Once you install the yum .repo file belonging to the testing repository and perform a 'yum update' any mingw32-* packages which you might have already installed will be replaced by ones produced using the mingw-w64 toolchain

If you want to test building packages for the Win64 target you can install the 'mingw64-gcc' package (or the 'cross-gcc' package which will pull in both the 'mingw32-gcc' package as well as the 'mingw64-gcc' package). Once the compiler is installed you can build binaries for the Win64 target using commands like 'i686-w64-mingw32-gcc'. Also note that the name of the gcc command for the Win32 target has been changed from 'i686-pc-mingw32' to 'i686-w64-mingw32-gcc' and that all files which used to be in /usr/i686-pc-mingw32/ have now been moved to /usr/i686-w64-mingw32/

Generated binaries can be tested using the x86_64 version of wine

User Experience

The user experience will be that developers using Fedora can now build binaries for both the Win32 as well as the Win64 target

Dependencies

  • The 5 toolchain packages (cross-filesystem, cross-binutils, cross-gcc, mingw-headers and mingw-crt) are new packages and have to pass the package review process
  • The mingw-headers and mingw-crt packages have to be cleared by FE-Legal
  • The Fedora MinGW Packaging guidelines have to be updated and approved

Contingency Plan

If the 5 toolchain packages can't be approved in time we can stick with the current mingw32-* packages and move this feature to the next Fedora release

Documentation

All documentation about this cross compiler framework can be found at MinGW/CrossCompilerFramework and on the mingw@lists.fedoraproject.org mailing list

Release Notes

This release of Fedora contains a cross compiler framework which makes it easier for packagers and developers to build binaries for the Win32 as well as Win64 targets. The mingw-w64 toolchain has been used for this

Comments and Discussion