GCC 4.6 and fully compliant Darwin10 ld

Ruben Van Boxem vanboxem.ruben at gmail.com
Wed Sep 21 05:52:50 PDT 2011


Some time ago I contacted your -users mailing list about how good your GCC
4.6 is compared to the 4.2.1 by Apple.

Someone replied that it works, with some open bugs not present in 4.5, but
that there were things that needed giving up like universal binary creation,
due to GCC not accepting the -arch option.

I contacted Erik van Pienbroek, who is the maintainer/developer of Fedora
Linux's Darwinx cross-compiler for Mac.
Here's what Erik had to say about the missing -arch option:

The /usr/bin/gcc binary on Mac OS X is in fact not the real gcc
> compiler, but a small wrapper. This wrapper is the magic piece that
> accepts the '-arch' arguments, calls the real gcc once or multiple times
> and bundles the end result automatically together using lipo. The code
> for this wrapper is open sourced and can be found at
> http://opensource.apple.com/source/gcc/gcc-5666.3/driverdriver.c
> With minor patching it is perfectly possible to get this code compiled
> for native Linux environments. See http://svn.openftd.org/viewvc/Fedora%
> 20Cross%20Compiler%20Framework/darwinx/darwinx-gcc/<http://svn.openftd.org/viewvc/Fedora%20Cross%20Compiler%20Framework/darwinx/darwinx-gcc/>for more details
> about that.
> Given this fact, it shouldn't really matter in the end which version of
> GCC is used.
I also have an open bug report about cross-compiling a Mac hosted
Mingw-targetting GCC using that darwinx toolchain here:

The reason I mention it is that maybe you guys could help, and furthermore
the fact that someone mentioned in a comment that the odcctools in the
darwinx toolchain (which are the same in MacPorts) do not support the
-no_compact_unwind option, which was added in the darwin10 build of GCC.

Here's what Erik had to say about this:

The Mac OS X 10.5 SDK seems to be based on darwin10 and not darwin9. If
> you look at the contents of the SDK you'll notice that there are folders
> named /usr/darwinx/SDKs/MacOSX10.5.
> sdk/usr/lib/i686-apple-darwin10
> and /usr/darwinx/SDKs/MacOSX10.5.sdk/usr/lib/powerpc-apple-darwin10.
> What I think is the case here is that the odcctools we're using is
> bundling a too old copy of ld64. If you take a look at
> http://code.google.com/p/iphone-dev/source/browse/branches/odcctools-9.2-ld/ld64/src/Options.cppyou'll see that this copy of ld64 doesn't support the compact unwind option.
> The version of odcctools mentioned at MacPorts also seems to be outdated.
> The code at the Apple website at
> http://opensource.apple.com/source/ld64/ld64-123.2.1/src/ld/Options.cpp
> does seem to support the compact unwind option. I can try to get this
> version of ld built, but I don't know whether it will succeed as the
> code at the Apple website doesn't contain any Makefile's, so patching
> will be required.

He is having trouble compiling the new odcctools with GCC's newer than v4.4
due to C++ template errors.

I hope you guys can help each other out in both toolchain issues!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20110921/913f240e/attachment-0001.html>

More information about the macports-dev mailing list