gcc and universal binaries

Jeremy Huddleston Sequoia jeremyhu at macports.org
Sun Aug 25 08:33:09 PDT 2013


On Aug 25, 2013, at 4:21, Samuel Halliday <sam.halliday at gmail.com> wrote:

> Thanks all,
> 
> In order to build a ppc gfortran app, I need the Xcode 3 PPC compiler (I think that's what a lot of these comments have been about). There is a SO thread about how to do this:
> 
>  http://stackoverflow.com/questions/5333490
> 
> But once I have my universal gcc48 (not apple-gcc*), it would appear that the -arch flags must be passed one at a time. BTW, it seems the default gcc48 can build 32 bit fortran apps (even though it's a x86_64 build) but can't link them (hence the need for "gcc48 +universal").
> 
> Before I embark on the insane mission of obtaining xcode3 ppc compilers, can somebody confirm for me if the "gcc48 +universal" (with universal including ppc) will be able to compile ppc binaries using "-arch ppc"?

No, it won't.  +universal in the gcc ports means i386/x86_64 or ppc/ppc64:

platform powerpc {
    configure.universal_archs ppc ppc64
}
platform i386 {
    configure.universal_archs i386 x86_64
}

If you want to fix that, you'll need to bring the Apple gcc driver driver into the gccXX ports and update those ports to build once for ppc and then again for i386 ... see the apple-gcc42 port for how this is done as well as the driver driver source code.

> * one could edit https://trac.macports.org/browser/trunk/dports/lang/apple-gcc42/Portfile to include the fortran language, but I'd rather not get into customising portfiles. Besides, I thought apple used LLVM nowadays.

You're not going to solve this without either:
  1) Moving to Snow Leopard or earlier (so you can have a MacPorts ppc runtime, so you can have a gfortran compiler that produces ppc code)
  2) Making a darwin-ppc cross compiler (again, not in MacPorts, but our assembler (cctools) and linker (ld64) should work for you)
  3) Adding fortran support to apple-gcc42 (and using the 10.5 or 10.4u SDK)
  4) Adding support for generating ppc code with the gccXX ports when running on intel

You're going to need to change around Portfiles or do a lot by hand to solve this problem.

Alternatively, you could have a SL or Leopard machine do the ppc bits and a ML machine do the i386/x86_64 bits.  Then just lipo them all together into the final executable.  This is essentially how I build the host support library that is shipped with quartz-wm.

--Jeremy

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4145 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macports-users/attachments/20130825/32708399/attachment.p7s>


More information about the macports-users mailing list