[Numpy-discussion] Problem with numpy and distutils on OS X
Fri May 9 11:17:50 CDT 2008
I'm writing a standard distutils setup.py to compile a Python C
extension on OS X 10.4, and I need to specify a few special compiler
options to enable vector CPU extension (altivec and SSE on i686 and
PPC respectively). This compromises the generation of universal
binaries, because these options are CPU-specific, and cannot be
passed to gcc together with "-arch ppc -arch i386".
I'm happy with generating a nonuniversal extension, which I can do
(at least with distutils 2.4.4) by specifying an extra "-arch i386"
compiler option. Distutils has some Darwin-specific code that catches
that, and takes out the "-arch ppc" option that would be there by
All well, but then in my setup.py I also import numpy (to find out
where its C includes are). If I do that, the behavior of distutils
changes, and the "-arch ppc" option is not taken out, so compilation
So I have questions:
- Is this an acceptable behavior for numpy to have? Should it modify
other modules? I understand that there is a numpy.distutils, but
shouldn't I have a choice to use it explicitly, and get the old
distutils behavior by using that namespace?
- Is there a way to avoid or disable this interference?
- Finally, is there a way to compile universal binaries with CPU-
My python is 2.4.4. My numpy is version 1.0.4. gcc is 4.0.1.
Thanks a lot!
More information about the Numpy-discussion