[SciPy-Dev] Compiling/packaging SciPy on Windows with Visual Studio compilers

Marcus D. Hanwell marcus.hanwell at kitware.com
Thu Jun 4 09:20:30 EDT 2015


On Thu, Jun 4, 2015 at 8:37 AM, Sturla Molden <sturla.molden at gmail.com> wrote:
> On 03/06/15 21:20, Marcus D. Hanwell wrote:
>
>>> You will need a Fortran compiler which is actually compatible with the
>>> Visual Studio linker. With gfortran you need to use gcc as linker.
>>
>> Thanks for the tips, I was hoping to adapt the work we did here to
>> make things a little smoother,
>> http://www.kitware.com/blog/home/post/231,
>
> MSVC does not know what to do with an object file from gfortran, nor
> what to do with libgfortran.a or mingw32.a.
>
> You can use a DLL created with gfortran in MSVC, either by creating a
> .lib import library for the DLL or by using LoadLibrary from the Win32
> API. This is what you e.g. would do to use OpenBLAS from MSVC.
>
> But this is NOT what you need to build an f2py extension module for
> Python. It contains C and Fortran code, and it must be linked together
> into a single .pyd file. Therefore you must have linker that understands
> object files from gfortran AND the C compiler, and only gcc (MinGW) can
> do that.

This is the level of detail I needed, thanks for filling me in.
>
>  > I don't have access to the
>  > commercial Fortran compilers, but it is great to hear what approaches
>  > have been tried.
>
> This makes it very simple. Without access to a commercial Fortran
> compiler you cannot build SciPy with Visual Studio given the current
> build utils.
>
Great, I really appreciate the additional information. I had hoped
this would be simpler on Windows, but certainly appreciate you laying
out the options. We will rethink our approach on that platform, SciPy
is a great stack but the MSVC/Fortran situation makes it tough to
bundle with a desktop application. It is important for us to be able
to share memory between C++ and Python, hence the direction we are
pursuing...

Best,

Marcus



More information about the SciPy-Dev mailing list