gcc and universal binaries

Mojca Miklavec mojca at macports.org
Sat Aug 24 08:23:58 PDT 2013


On Sat, Aug 24, 2013 at 5:08 PM, Samuel Halliday wrote:
> Thanks Ryan,
>
> Assuming my Mountain Lion can actually build PPC binaries,

It cannot. You really need to use Snow Leopard if you want to build
for x86_64, i386 and ppc (conditionally Leopard, but support for
x86_64 is not quite mature there yet). I don't know about ppc64, but
basically nobody uses those.

Also, if you are using Mountain Lion your binaries will only work on
Lion (if you configure the project properly, otherwise it will only
work on 10.8 and later) and Lion doesn't work on PowerPC and i386, it
doesn't even work on all 64-bit machines.

> Also, what command line arguments do I use to get universal builds in my own projects?

export CFLAGS="-arch i386 -arch ppc -arch x86_64"

and same for CXXFLAGS, LDFLAGS, ... I would say also FFLAGS, but I'm
not sure where you will get a suitable fortran compiler to accept
these. You might need to compile for each architecture separately and
lipo the binaries together at the end (I might be wrong, but Fortran
compilers are a mess with relatively pure support in general. You
first need to check which flags are supported by the Fortran compiler.
Maybe the gnu compiler started supporting -arch recently, but some
years ago it only supported "-m32" and "-m64". There were some other
compilers that supported "-arch")

Mojca

PS: Honestly, if you plan to build Fortran code for four
architectures, all I can say is "good luck". It's probably not
impossible, but you'll need a bit more than a few settings in MacPorts
configuration, and you definitely need an older OS first.


More information about the macports-users mailing list