[MacPorts] #48857: gcc ports: support compiling multiple archs (universal) using the Apple GCC driver
MacPorts
noreply at macports.org
Mon Sep 14 02:48:13 PDT 2015
#48857: gcc ports: support compiling multiple archs (universal) using the Apple GCC
driver
---------------------------------+-------------------------------------
Reporter: frederic.devernay@… | Owner: macports-tickets@…
Type: enhancement | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.3.3
Keywords: | Port: gcc46 gcc47 gcc48 gcc49
---------------------------------+-------------------------------------
Apple's gcc, llvm-gcc and clang have a nice feature, which is taht
multiple archs can be specified on the same command-line (e.g. "-arch i386
-arch x86_64").
GNU's gcc, as installed by the gcc ports in MacPorts, doesn't have this
feature, and thus most ports (actuall all non-muniversal ports) cannot be
built universal using gcc.
With the following enhancements, *all* ports could be built universal
using a modern GNU gcc (with proper OpenMP support etc.)
Actually, what apple did was to write a simple wrapper that calls gcc
twice, and then lipo to merge the two objects. That driver can be compiled
with modern gcc versions, and works very well.
It's a single C file, called driverdriver.c, and can be found at:
http://www.opensource.apple.com/source/gcc/gcc-5666.3/driverdriver.c?txt
John Bower manage to modify and build that driver for GNU GCC, as
installed by macports:
http://thecoderslife.blogspot.fr/2015/07/building-with-gcc-46-and-
xcode-4.html
That blog article is about gcc 4.6, but I tested it with GCC 4.8 (built
with +universal) and it works very well. I now have to binaries (gcc-mp
and g++-mp) that behave exactly like Apple's GCC.
His source code can be found at:
https://github.com/jhnbwrs/macportsGCCfixup
He added also building and installing configurations for Xcode, but we
don't really need these (although that would be a bonus). The main
improvement would be the driver.
--
Ticket URL: <https://trac.macports.org/ticket/48857>
MacPorts <https://www.macports.org/>
Ports system for OS X
More information about the macports-tickets
mailing list