[SciPy-User] numpy.distutils cross compile question

Ralf Gommers ralf.gommers at gmail.com
Fri Nov 2 15:37:44 EDT 2012


On Tue, Oct 30, 2012 at 4:18 AM, Zhenfei Yuan <zfyuan at mail.ustc.edu.cn>wrote:

> Dear all.
>
>      I've written a small package in my field  containing  some pure
> python scripts and fortran extension libraries. At first I just use f2py
> for the compiling work before importing these extensions into python and
> they all worked well. This time, I write a "setup.py" file which import
> "setup" function in "numpy.distutils.core" and will build a scipy sub
> package on my ubuntu 64 machine, with gfortran specified by the command
> "python setup.py build fgnu95", which works well.
>
>      My questions comes with the problem when I'd like to  build a win
> 32/64 package. I think it concerns cross compiling, so I installed mingw
> compilers like "i686-w64-mingw32-gfortran" and "i686-w64-mingw-32-gcc"
> on my ubuntu 12.04. However I don't know how to write the setup.py file
> for cross compiling using numpy.distutils. I tried typing "python
> setup.py" and specify fortran compiler by typing
> "fi686-w64-mingw32-gfortran" for building, however it doesn't work. So
> I'm wondering whether I have to build this package on linux 32, 64 bit
> and win 32, 64 bit?
>

I don't think that will work. Even if the compilers would work, distutils
isn't flexible enough to pass the right flags to them. If you want to build
Windows binaries on Linux, you should use install MinGW under Wine. Even
that is a little painful, but Ondrej Certik recently wrote some scripts to
install everything that's needed: https://github.com/certik/numpy-vendor

Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20121102/902db9a9/attachment.html>


More information about the SciPy-User mailing list