compiling C-extensions with MSVC produce warning
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
Medium
|
Martin Pool |
Bug Description
Pyrex 0.9.6.4, bzr.dev revno.3763, Python 2.5.2:
There is warning C4007: 'WinMain' : must be '__stdcall'
It seems like some headers should be included in proper order.
Log of python setup.py build_ext:
running build_ext
pyrexc bzrlib/
building 'bzrlib.
creating build\temp.
creating build\temp.
creating build\temp.
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -IC:\Python\
_btree_
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\
creating build\lib.win32-2.5
creating build\lib.
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\
Creating library build\temp.
pyrexc bzrlib/
building 'bzrlib.
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -IC:\Python\
_knit_load_data_c.c
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\
Creating library build\temp.
pyrexc bzrlib/
building 'bzrlib.
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -IC:\Python\
_dirstate_
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\
...
Changed in bzr: | |
status: | Fix Committed → Fix Released |
Oh, it's a known Pyrex bug.
Workaround is the same as I do for walkdirs_win32: define macros WIN32.
Here the patch:
--- setup.py 2008-10-02 15:36:12 +0000
ext_modules. append( Extension( module_ name, [c_name], **kwargs))
+++ setup.py 2008-10-03 09:59:46 +0000
@@ -226,18 +226,21 @@
-add_pyrex_ extension( 'bzrlib. _btree_ serializer_ c') extension( 'bzrlib. _knit_load_ data_c' ) extension( 'bzrlib. _dirstate_ helpers_ c', ['Ws2_32' ] extension( 'bzrlib. _btree_ serializer_ c', macros= [('WIN32' , None)]) extension( 'bzrlib. _dirstate_ helpers_ c', ['Ws2_32' ], macros= [('WIN32' , None)], pyrex_extension ('bzrlib. _walkdirs_ win32',
define_ macros= [('WIN32' , None)]) extension( 'bzrlib. _btree_ serializer_ c')
add_pyrex_
if sys.platform == 'win32':
- add_pyrex_
- libraries=
- )
# pyrex uses the macro WIN32 to detect the platform, even though it should
# be using something like _WIN32 or MS_WINDOWS, oh well, we can give it the
# right value.
+ add_pyrex_
+ define_
+ add_pyrex_
+ libraries=
+ define_
+ )
add_
else:
+ add_pyrex_
if have_pyrex and pyrex_version == '0.9.4.1':
# Pyrex 0.9.4.1 fails to compile this extension correctly
# The code it generates re-uses a "local" pointer and