[issue2698] Extension module build fails for MinGW: missing vcvarsall.bat

Lenard Lindstrom report at bugs.python.org
Sat Apr 26 19:20:24 CEST 2008


New submission from Lenard Lindstrom <len-l at telus.net>:

Python 2.6a2 on Windows XP

Distutils fails to build an extension module for MinGW. Even though 
mingw32 is specified as the compiler distutils.msvc9compiler is still 
loaded and it cannot find vcvarsall.bat. Here is an example:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

[snip]

C:\pygame\ext>path=%path%;C:\python26;C:\mingw\bin

C:\pygame\ext>set MINGW_ROOT_DIRECTORY=C:\mingw

C:\pygame\ext>python setup.py build --compiler=mingw32
running build
running build_ext
error: None

C:\pygame\ext>python setup.py build_ext --compiler=mingw32
Traceback (most recent call last):
  File "setup.py", line 6, in <module>
    ext_modules=[Extension('simple', ['simple.c',]),],
  File "C:\python26\lib\distutils\core.py", line 137, in setup
    ok = dist.parse_command_line()
  File "C:\python26\lib\distutils\dist.py", line 459, in 
parse_command_line
    args = self._parse_command_opts(parser, args)
  File "C:\python26\lib\distutils\dist.py", line 517, in 
_parse_command_opts
    cmd_class = self.get_command_class(command)
  File "C:\python26\lib\distutils\dist.py", line 836, in 
get_command_class
    __import__ (module_name)
  File "C:\python26\lib\distutils\command\build_ext.py", line 21, in 
<module>
    from distutils.msvccompiler import get_build_version
  File "C:\python26\lib\distutils\msvccompiler.py", line 658, in 
<module>
    from distutils.msvc9compiler import MSVCCompiler
  File "C:\python26\lib\distutils\msvc9compiler.py", line 286, in 
<module>
    VC_ENV = query_vcvarsall(VERSION, ARCH)
  File "C:\python26\lib\distutils\msvc9compiler.py", line 253, in 
query_vcvarsall
    raise IOError("Unable to find vcvarsall.bat")
IOError: Unable to find vcvarsall.bat

C:\pygame\ext>type setup.py
from distutils.core import setup, Extension

setup(name='Simple',
      version='1.0',
      description='Python extension module test',
      ext_modules=[Extension('simple', ['simple.c',]),],
      )


C:\pygame\ext>gcc --version
gcc (GCC) 3.4.5 (mingw special)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is 
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.


C:\pygame\ext>python -V
Python 2.6a2

----------
components: Distutils
messages: 65850
nosy: kermode
severity: normal
status: open
title: Extension module build fails for MinGW: missing vcvarsall.bat
versions: Python 2.6

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2698>
__________________________________


More information about the Python-bugs-list mailing list