gcc and universal binaries

Ned Deily nad at acm.org
Sat Aug 24 17:09:56 PDT 2013


In article <B673F8F2-3C21-4EA7-B5F7-2B33FD89545E at gmail.com>,
 Samuel Halliday <sam.halliday at gmail.com> wrote:
> On 24 Aug 2013, at 16:24, Ryan Schmidt wrote:
> >> what command line arguments do I use to get universal builds in my own 
> >> projects?
> > 
> > add all the -arch flags (e.g. "-arch x86_64 -arch i386 -arch ppc64 -arch 
> > ppc") 
> 
> 
> I'm guessing these instructions are for the apple gcc? Because doing this 
> with the gcc / gfortran that I've been installing with macports gives
> 
> gcc-mp-4.8: error: unrecognized command line option '-arch'
> 
> and trying to compile C code on Mountain Lion with the apple gcc gives
> 
> llvm-gcc-4.2: error trying to exec 
> '/usr/bin/../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2': execvp: 
> No such file or directory
> llvm-gcc-4.2: error trying to exec 
> '/usr/bin/../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2': execvp: 
> No such file or directory
> 
> 
> So I'm concluding it is impossible to build universal fortran apps since the 
> apple gcc doesn't come with gfortran. My only hope would be to build separate 
> binaries for each architecture by:
> 
> 1. access to old OS X machines (+ macports)
> 2. cross compile
> 
> I don't have access to old machines (and it would be incredibly inconvenient 
> in any case), and I'm guessing macports doesn't supply cross compilers for 
> older OS X architectures.

You *might* be able to build for all four architectures on Mountain LIon 
if you can successfully install a version of Xcode 3 (like 3.2.6) as a 
secondary Xcode and use the build tools and 10.5 SDK it provides.  xcrun 
can help with this but I don't think MacPorts supports building with a 
non-installed SDK so you'd still be on your own.  Another, more reliable 
option to consider is running an older version of OS X, like 10.5 
server, as a virtual machine in VMware Fusion or similar.  Be aware that 
the software license of 10.5 (non-server) prohibited use as a virtual 
client and Fusion does enforce that but the Interwebs tell of ways to 
get around that when running on a Mac host.

-- 
 Ned Deily,
 nad at acm.org



More information about the macports-users mailing list