[SciPy-dev] OS X universal SciPy: success!
Tue Aug 14 04:03:20 CDT 2007
I've been trying to easily build an OS X universal SciPy for some
time now.  My prior efforts consisted of lipo-ing together the PPC
and x86 'Superpacks' put together by Chris Fonnesbeck , which
worked for distributing my image processing app locally. However,
this isn't really a good way to do it, specially not for putting up
for general use.
I came across a successful Universal build of gfortran [4,5], and
then shortly found this message  claiming it could possibly be
used to build a universal SciPy.
So, I gave it a shot and it works! (with some tricks...)
The build has both ppc and i386 architectures in every .so in the
scipy install. The tests run fine on my G4, but I haven't yet had the
chance to try it on an Intel Mac. If anyone is keen to do so, please
let me know.
There will need to be some modifications to numpy distutils, since it
presumes that there isn't a universal Fortran. The patch below is
just a hack to get it working, and will break any non-universal
gfortran. Essentially, all that needs to happen is to have '-arch ppc
-arch i386' added to any call to gfortran (both compile and link) ,
and the '-march' flags removed.
What's the best way to add this functionality to numpy distutils? I
couldn't think of any way to test for a universal compiler, other
than trying to compile a test file and seeing if it dies with the
multiple arch flags.
$ svn diff gnu.py
--- gnu.py (revision 3964)
+++ gnu.py (working copy)
@@ -102,6 +102,7 @@
opt.extend(['-undefined', 'dynamic_lookup', '-bundle'])
+ opt.extend(['-arch ppc -arch i386'])
@@ -183,12 +184,13 @@
# Since Apple doesn't distribute a GNU Fortran
# can't add -arch ppc or -arch i386, as only their version
# of the GNU compilers accepts those.
- for a in '601 602 603 603e 604 604e 620 630 740 7400
- '403 505 801 821 823 860'.split():
- if getattr(cpu,'is_ppc%s'%a)():
+ #for a in '601 602 603 603e 604 604e 620 630 740 7400
+ # '403 505 801 821 823 860'.split():
+ # if getattr(cpu,'is_ppc%s'%a)():
+ # opt.append('-mcpu='+a)
+ # opt.append('-mtune='+a)
+ # break
+ opt.append('-arch ppc -arch i386')
More information about the Scipy-dev