[Numpy-discussion] mingw-w64 tutorial ?

Sebastian Haase seb.haase@gmail....
Sun Aug 22 02:41:39 CDT 2010


On Sun, Aug 22, 2010 at 8:40 AM, Sebastian Haase <seb.haase@gmail.com> wrote:
> On Sun, Aug 22, 2010 at 8:16 AM, Sebastian Haase <seb.haase@gmail.com> wrote:
>> On Sun, Aug 22, 2010 at 3:39 AM, Sebastian Haase <seb.haase@gmail.com> wrote:
>>> On Sun, Aug 22, 2010 at 12:02 AM, Christoph Gohlke <cgohlke@uci.edu> wrote:
>>>>
>>>>
>>>> On 8/21/2010 2:37 PM, Sebastian Haase wrote:
>>>>> On Sat, Aug 21, 2010 at 11:29 PM, Christoph Gohlke<cgohlke@uci.edu>  wrote:
>>>>>>
>>>>>>
>>>>>> On 8/21/2010 1:44 PM, Sebastian Haase wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> this is somewhat OT for this list, but since I know that David and
>>>>>>> many others here have lot's of experience compiling C extensions I
>>>>>>> thought I could just ask:
>>>>>>> Looking at
>>>>>>> http://sourceforge.net/projects/mingw-w64/files/
>>>>>>> I did not know (even after reading the FAQ) which file to download and
>>>>>>> how things would eventually work.
>>>>>>>
>>>>>>> I have a 64bit windows 7 installed, and got many precompiled packages
>>>>>>> for amd64 Python 2.7 from
>>>>>>> http://www.lfd.uci.edu/~gohlke/pythonlibs/
>>>>>>> (thanks to  Christoph Gohlke for all the work)
>>>>>>> But now I have some C++ extensions on my own, and know how build them
>>>>>>> using cygwin -- but that would only produce 32bit modules and should
>>>>>>> be unusable.
>>>>>>>
>>>>>>> So, the question is if someone has or knows of some tutorial about how
>>>>>>> to go about this - step by step. This info could maybe even go the
>>>>>>> scipy wiki....
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Sebastian Haase
>>>>>>
>>>>>>
>>>>>> Hi Sebastian,
>>>>>>
>>>>>> I am not aware of such a tutorial. There's some information at
>>>>>> <http://projects.scipy.org/numpy/wiki/MicrosoftToolchainSupport>
>>>>>>
>>>>>> I did not have good experience last time (about a year ago) I tried
>>>>>> mingw-w64. Occasional crashes during compilation and at runtime.
>>>>>> Probably that has changed. At least you have to create the missing
>>>>>> libpython and libmsvcr90 libraries from the dlls and make libmsvcr90 the
>>>>>> default crt.
>>>>>>
>>>>>> You probably know that the "free" Windows 7 Platform SDK can be used to
>>>>>> build Python>=2.6 extensions written in C89.
>>>>>> <http://mattptr.net/2010/07/28/building-python-extensions-in-a-modern-windows-environment/>
>>>>>>
>>>>>> --
>>>>> Hi Christoph,
>>>>>
>>>>> I did not exactly know this - thanks for the info (I knew about
>>>>> something called Visual Studio Express 2003- but that only
>>>>> works/worked for Python 2.5, I think...)
>>>>
>>>> You can use Visual Studio Express 2008 for building 32 bit extensions
>>>> for Python >=2.6.
>>>>
>>>>>
>>>>> Rephrasing my original question: Is the mingw-w64 at all "easy" by now
>>>>
>>>> Don't know. David Cournapeau probably has the most experience.
>>>>
>>>> http://bugs.python.org/issue4709
>>>> http://www.equation.com/servlet/equation.cmd?call=fortran
>>>>
>>>>> ? How about cross compiling to 64bit Windows from a 32bit Ubuntu (that
>>>>> I could easily run on virtualbox) ?
>>>>
>>>> I am also interested in cross compiling on Ubuntu but have not found the
>>>> time to get started. The IOCBio project cross-compiles their 32 bit
>>>> extensions on Linux
>>>> <http://code.google.com/p/iocbio/wiki/BuildWindowsInstallersOnLinux>.
>>>> But as you can see they use Wine and Mingw...
>>>>
>>>>>
>>>>> (But I'm not apposed at all to the "free" Windows 7 Platform SDK, so
>>>>> I'll look into that -- giant download !?)
>>>>
>>>> About one GB.
>>>>
>>>>>
>>> Do you know if that contains a C++ compiler ?  The first page before
>>> it starts the actual download has "Visual C++ Compilers" grayed out
>>> ... !?
>>>
>>> -Sebastian
>>>
>> Ok, apparently I had to install the "dot NET Framework 4" from
>> http://msdn.microsoft.com/en-us/netframework/aa569263.aspx
>> first, before then the C++ could be installed.
>> But now setup.py still complains:
>>       error: Unable to find vcvarsall.bat
>> and I think it is looking for
>> C:\Program Files (x86)\Microsoft Visual Studio 9.0
>> while that file got installed in
>> C:\Program Files (x86)\Microsoft Visual Studio 10.0
>> I don't know how to get the "log.debug" messages from the setup.py
>> script activated...
>> ?
>
> I got the debug out by adding a "-d"
> \Python27\python.exe setup.py -v build
> (even though setup.py --help  states that --verbose should be already
> the default, well...)
>
> Then I mentioned the environment variable %VS90COMNTOOLS%
> which I then set to
> $$>set VS90COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin
>
> But now I'm getting a traceback:
>  File "C:\Python27\lib\distutils\msvc9compiler.py", line 469, in compile
>    self.initialize()
>  File "C:\Python27\lib\distutils\msvc9compiler.py", line 379, in initialize
>    vc_env = query_vcvarsall(VERSION, plat_spec)
>  File "C:\Python27\lib\distutils\msvc9compiler.py", line 295, in
> query_vcvarsall
>    raise ValueError(str(list(result.keys())))
> ValueError: [u'path']
>
> Well, still trying ....
> Cheers,
> Sebastian
>
Now, I renamed the file
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat
(as mentioned in
http://mattptr.net/2010/07/28/building-python-extensions-in-a-modern-windows-environment/)
to
vcvars64.bat
and moved it to
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64

The compiler races through and I end up getting linker problems:
LINK : error LNK2001: unresolved external symbol init_sebmodule

We'll see,
Sebastian


More information about the NumPy-Discussion mailing list