[Numpy-discussion] Building f2py extensions on AMD64 with Python 2.7 Numpy 1.5, MSVC 2008 Pro and gfortran

David Cournapeau cournape at gmail.com
Mon Aug 16 13:02:08 EDT 2010


On Tue, Aug 17, 2010 at 1:53 AM, Eric Firing <efiring at hawaii.edu> wrote:
> On 08/15/2010 11:14 PM, Sturla Molden wrote:
>> Two criticial import libraries for mingw-w64 are missing (libpython26.a
>> and msvcr90.a). We cannot build C extensions for Python with mingw-w64. If
>> you can build with disutils, your are not using mingw-w64 but another C
>> compiler.
>
> Sturla,
>
> Have you tried the Equation Solution versions of the gcc tools?
> http://www.equation.com/servlet/equation.cmd?fa=fortran

It has the same issues last time I checked. The problem is that
libgfortran relies a lot on the mingw runtime, which has
incompatibilities with the msvc C runtime - much more it seems that
the g77 ever did. The fact that it worked for scipy was pure luck,
though.

I think the right solution is to build our own libgfortran, but
against the MSVC C runtime instead of the mingw runtime. THis is not
as crazy as it sounds because scipy does not rely so much on the
fortran runtime. Just faking the library (by putting functions which
do nothing), I could run half of scipy last time I tried. I also
started working on removing most of the fortran IO code in scipy
(which would cause issues anyway independently of this issue), but
then I started my new job :)

It is unlikely I will work on this again in the near future, but it
should not be so hard for anyone who has incentive to make this work,

cheers,

David
> Eric
>
>
>>
>> There are rumors of incompatibility issues between libgfortran and the CRT
>> or SciPy on Windows 64. David Cournapeau might know the details.
>>
>> It seems f2py on Windows 64 requires a commercial Fortran compiler (the
>> ones worth looking at are Absoft, Intel and PGI) and e.g. Microsoft's free
>> C/C++ compiler (download Windows 7 SDK for .NET 3.5 -- not any later or
>> earlier version). You need to have the environment variables
>> DISTUTILS_USE_SDK and MSSdk set to build with the free SDK compiler. f2py
>> will enforce the former, the latter comes from running setenv from the
>> SDK. The latter is important as you will need to set up the environments
>> for the Fortran and the C compiler in the same command window before
>> running f2py.
>>
>> I also had to remove support for Compaq Visual Fortran from the f2py
>> source to  make anything build, as it crashes f2py on Windows 64 (this
>> does not happen on 32-bit Windows).
>>
>> Building f2py extensions on Windows 64 is a bit more tricky. And I've had
>> no luck with gfortran so far.
>>
>> Sturla
>>
>>
>>
>>> Hi all,
>>>
>>> Are there any success stories in building f2py extensions on AMD64 with
>>> latest versions? Building the same extension on 32 bit works like a charm.
>>>
>>> I am having trouble finding documentation or examples, is it supposed to
>>> be
>>> working?
>>>
>>> Compiling (with distutils) works like a charm, but that does not help when
>>> I'm stuck figuring out link dependencies. It seems to me that the gfortran
>>> library depends on a mingw that is in conflict with some CRT library.
>>>
>>> I have to admit, I'm probably in way too deep waters, and should really be
>>> satisfied with 32 bit, but still, it would be fun to get it working.
>>>
>>> GFortran is from  MinGW-w64 project on sourceforge, version 4.5.1
>>> prerelease.
>>>
>>> Any pointers or other experiences?
>>>
>>> Regards,
>>> Åsmund Hjulstad
>>> _______________________________________________
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>
>>
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



More information about the NumPy-Discussion mailing list