[SciPy-user] Universal binary SciPy on OS X

Josh Marshall josh.p.marshall at gmail.com
Thu Dec 14 21:49:06 CST 2006


I have been trying to build a universal SciPy that works, so I can  
include it in a redistributable application I build with py2app.

The one at http://pythonmac.org/packages/py24-fat/index.html is  
*incomplete*, it contains some dynamic libraries which are ppc only,  
which is what also happens when I try to build a universal binary  
myself.Some libs build fine, but some are only a single arch (the  
native one).

The results of
      for FILE in `find . | grep '\.so'` ; do lipo -info $FILE ; done
are:
------------------------------------------------------------------------ 
-----------
Architectures in the fat file: ./scipy/cluster/_vq.so are: i386 ppc
Non-fat file: ./scipy/fftpack/_fftpack.so is architecture: ppc
Non-fat file: ./scipy/fftpack/convolve.so is architecture: ppc
Non-fat file: ./scipy/integrate/_odepack.so is architecture: ppc
Non-fat file: ./scipy/integrate/_quadpack.so is architecture: ppc
Non-fat file: ./scipy/integrate/vode.so is architecture: ppc
Non-fat file: ./scipy/interpolate/_fitpack.so is architecture: ppc
Non-fat file: ./scipy/interpolate/dfitpack.so is architecture: ppc
Architectures in the fat file: ./scipy/io/numpyio.so are: i386 ppc
Architectures in the fat file: ./scipy/lib/blas/cblas.so are: i386 ppc
Non-fat file: ./scipy/lib/blas/fblas.so is architecture: ppc
Architectures in the fat file: ./scipy/lib/lapack/atlas_version.so  
are: i386 ppc
Non-fat file: ./scipy/lib/lapack/calc_lwork.so is architecture: ppc
Architectures in the fat file: ./scipy/lib/lapack/clapack.so are:  
i386 ppc
Architectures in the fat file: ./scipy/lib/lapack/flapack.so are:  
i386 ppc
Non-fat file: ./scipy/linalg/_flinalg.so is architecture: ppc
Non-fat file: ./scipy/linalg/_iterative.so is architecture: ppc
Architectures in the fat file: ./scipy/linalg/atlas_version.so are:  
i386 ppc
Non-fat file: ./scipy/linalg/calc_lwork.so is architecture: ppc
Architectures in the fat file: ./scipy/linalg/cblas.so are: i386 ppc
Architectures in the fat file: ./scipy/linalg/clapack.so are: i386 ppc
Non-fat file: ./scipy/linalg/fblas.so is architecture: ppc
Non-fat file: ./scipy/linalg/flapack.so is architecture: ppc
Architectures in the fat file: ./scipy/linsolve/_csuperlu.so are:  
i386 ppc
Architectures in the fat file: ./scipy/linsolve/_dsuperlu.so are:  
i386 ppc
Architectures in the fat file: ./scipy/linsolve/_ssuperlu.so are:  
i386 ppc
Architectures in the fat file: ./scipy/linsolve/_zsuperlu.so are:  
i386 ppc
Architectures in the fat file: ./scipy/ndimage/_nd_image.so are: i386  
ppc
Non-fat file: ./scipy/odr/__odrpack.so is architecture: ppc
Non-fat file: ./scipy/optimize/_cobyla.so is architecture: ppc
Non-fat file: ./scipy/optimize/_lbfgsb.so is architecture: ppc
Non-fat file: ./scipy/optimize/_minpack.so is architecture: ppc
Architectures in the fat file: ./scipy/optimize/_zeros.so are: i386 ppc
Non-fat file: ./scipy/optimize/minpack2.so is architecture: ppc
Architectures in the fat file: ./scipy/optimize/moduleTNC.so are:  
i386 ppc
Architectures in the fat file: ./scipy/signal/sigtools.so are: i386 ppc
Architectures in the fat file: ./scipy/signal/spline.so are: i386 ppc
Non-fat file: ./scipy/sparse/sparsetools.so is architecture: ppc
Non-fat file: ./scipy/special/_cephes.so is architecture: ppc
Non-fat file: ./scipy/special/specfun.so is architecture: ppc
Non-fat file: ./scipy/stats/futil.so is architecture: ppc
Non-fat file: ./scipy/stats/mvn.so is architecture: ppc
Non-fat file: ./scipy/stats/statlib.so is architecture: ppc
Architectures in the fat file: ./scipy/stsci/convolve/_correlate.so  
are: i386 ppc
Architectures in the fat file: ./scipy/stsci/image/_combine.so are:  
i386 ppc
------------------------------------------------------------------------ 
-----------

So I didn't pursue this any further for the time being. Since I am  
not an expert on the SciPy build process, I'm trying to work around  
this.

Instead I took your (Chris') versions from http://trichech.us/? 
page_id=4 , both ppc and intel SuperPacks. I yanked the scipy dirs  
out of the packages, and called them scipy-ppc and scipy-i386. Then  
what I did was lipo the shared libs together, as described on Apple's  
site:
http://developer.apple.com/opensource/buildingopensourceuniversal.html

Like so:

mv scipy-ppc scipy-universal
cd scipy-universal
for FILE in `find . | grep '\.so'` ; do file $FILE ;  
done               # shows all ppc libs
for LIB in `find . | grep '\.so'` ; do lipo -create $LIB ../scipy- 
i386/$LIB -output $LIB ; done
for FILE in `find . | grep '\.so'` ; do file $FILE ;  
done              # shows all universal libs, yay!
cd ..
sudo cp -r scipy-universal $PYTHON_SITEPACKAGES/scipy

Now this works fine on my G4. I won't have a chance to test on an  
Intel Mac until later in the week, but this looks promising.

Chris, since the package seem to be identical apart from the shared  
libs, you could probably do this on the SuperPack and only need to  
distribute one version.

Could I also have some advice on how to deal with this sort of stuff.  
I imagine that much of it is tied up with not having an Apple-blessed  
Fortran compiler. (Fingers crossed for Leopard).

Thanks for all your help everyone,
Josh


More information about the SciPy-user mailing list