[Numpy-discussion] Compiler options for mingw?

Zachary Pincus zachary.pincus@yale....
Fri Nov 28 16:24:19 CST 2008

>> I'm curious about how to control compiler options for mingw builds of
>> numpy on windows... Specifically, I want to build binaries without  
>> SSE
>> support, so that they can run on older hardware.
> The windows binaries of numpy can run on machines without SSE support.
> If for some reason you want to build it by yourself, you just need a
> BLAS/LAPACK without SSE - assuming you want BLAS/LAPACK. Note that
> depending on your intent, all the scripts to generate the full binary
> (which install the most optimized binary depending on the detected
> arch) are in svn too, if that's something you want to do.
> I have recently remove the arch specific optimization in
> numpy.distutils, so this should not be a problem either.

Thanks for the information, David!

Regarding the windows binary installer, it appears that it selects the  
optimized/unoptimized binary at *install time*, which causes  
complications for further bundling of numpy with e.g. py2exe for use  
on other machines. (E.g. my dev machine has SSE3, and it appears that  
SSE3-optimized binaries get installed on it, which then causes  
crashing when I bundle up a numpy script with py2exe ad run it on an  
older box.) Is this in fact the case? If so, is there any easy way to  
force the installer to  just use the basic unoptimized configuration?  
That would be the best...

On the other hand, if I'm using a SSE-free BLAS/LAPACK or non at all,  
there'll be no SSE optimization done? I understand that gcc4, and thus  
mingw derived from that version, will automatically try to use sse  
instructions where possible if not specifically disabled, which is  
what induced my original question. So, to be certain that gcc isn't  
introducing sse instructions under the covers, I would still like to  
know if there's a way to pass compiler flags to the build stage of  
numpy. On UNIX, CFLAGS seems to do the trick, but on windows with  
mingw the flags don't seem to be recognized... (E.g. setting CFLAGS to  
'-mfoo' causes an invalid option error on OS X, but not with windows.)

Thanks again,

More information about the Numpy-discussion mailing list