gcc and universal binaries

Ryan Schmidt ryandesign at macports.org
Sat Aug 24 08:24:36 PDT 2013


On Aug 24, 2013, at 10:08, Samuel Halliday wrote:

> Assuming my Mountain Lion can actually build PPC binaries,

I'd be surprised if it could. I don't think Apple is including PowerPC compilers anymore.

> your solution would appear to want to build universal bins for everything on my system.

You'll only get universal builds if you ask for the +universal variant.

> Can I specify that I just want the gfortran and its deps to be built universally?

Yes, only install the gcc port you're using with the +universal variant (and don't use that variant for other unrelated ports). MacPorts will automatically install its dependencies with the universal variant, if they weren't already. If they were already installed with the old (i386 x86_84) universal variant, I do not know if MacPorts will rebuild them as 4-way universal for you; if it doesn't, the build will fail and you'll have to manually rebuild the ports, in the right order.

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

It varies from project to project. The default setup in MacPorts is to add all the -arch flags (e.g. "-arch x86_64 -arch i386 -arch ppc64 -arch ppc") to CFLAGS, CXXFLAGS, LDFLAGS, OBJCFLAGS, OBJCXXFLAGS. But not all projects respect those variables. Also, some projects will not build correctly for multiple architectures: either the build will fail, or the build will succeed but be faulty. To fix this, you have to build the project separately for each architecture and then all the different versions of each library or binary need to be joined together using `lipo`.




More information about the macports-users mailing list