[egenix-users] Cygwin compile problem in commercial 2.0.6

Steve Holden sholden at holdenweb.com
Mon Nov 17 13:06:47 CET 2003


[mal][...]
>
> These are causing the problem it seems: ULONG, USHORT, PVOID, etc.
> Could be that cygwin needs another header file to be included
> prior to including sqltypes.h - the one that defines ULONG etc.
>
> In mxODBC 2.1.0 which is not available outside the mxODBC Zope DA,
> the following was added to mxODBC.h near the top (line 213):
>
> """
> /* For cygwin, we need the Windows #defines here in addition to any
>     SQL header files. */
>
> #ifdef __CYGWIN__
> # include <windows.h>
> #endif
> """
>
> (and the records says that this was suggested by Steve Holden ;-)
>

Inserting that code did remove the compilation errors, which were then
replaced by futile attempts to use iODBC. I traced this to several spots
in the mxCOMMERCIAL.py code where the test for windows was

	if sys.platform[:3] == 'win':

when it really needs to be

	if sys.platform[:3] == 'win' or sys.platform[-3:] == 'win':

or similar, I suspect, to catch "cygwin" as the platform as well as
"win". Now my problems are somewhat different:

sholden at DellBoy ~/egenix-mx-commercial-2.0.6
$ python setup.py install
running install
running build
running mx_autoconf
gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -D_GNU_SOURCE=1 -I/usr/inc
lude/python2.3 -I/usr/include -c _configtest.c -o _configtest.o
success!
removing: _configtest.c _configtest.o
running build_ext
building 'mx.ODBC.Windows.mxODBC' extension
creating build/temp.cygwin-1.5.5-i686-2.3/mx/ODBC/Windows
creating build/temp.cygwin-1.5.5-i686-2.3/mx/ODBC/Windows/mxODBC
creating build/temp.cygwin-1.5.5-i686-2.3/mx/ODBC/Windows/mxODBC/mx
creating build/temp.cygwin-1.5.5-i686-2.3/mx/ODBC/Windows/mxODBC/mx/ODBC
creating
build/temp.cygwin-1.5.5-i686-2.3/mx/ODBC/Windows/mxODBC/mx/ODBC/Windows
gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -DMS_ODBC_MANAGER -Imx/ODB
C/Windows -I/usr/include/python2.3 -I/usr/include -c
mx/ODBC/Windows/mxSQLCodes.cpp -o build/temp.cygwin-1.5.5-i686-
.3/mx/ODBC/Windows/mxODBC/mx/ODBC/Windows/mxSQLCodes.o
mx/ODBC/Windows/mxSQLCodes.cpp: In function `PyObject*
   mxODBC_SQLCodes_lookup(PyObject*, PyObject*)':
mx/ODBC/Windows/mxSQLCodes.cpp:6450: warning: comparison between signed
and
   unsigned integer expressions
gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -DMS_ODBC_MANAGER -Imx/ODB
C/Windows -I/usr/include/python2.3 -I/usr/include -c mx/ODBC
/Windows/mxODBC.cpp -o
build/temp.cygwin-1.5.5-i686-2.3/mx/ODBC/Windows/mxODBC/mx/ODBC/Windows/
mxODBC.o
mx/ODBC/Windows/mxODBC.cpp:593: error: storage size of
`mxODBCursor_Methods'
   isn't known
mx/ODBC/Windows/mxODBC.cpp:593: error: storage size of
`mxODBCursor_Methods'
   isn't known
mx/ODBC/Windows/mxODBC.cpp: In function `PyObject*
   mxODBC_StringFromString(mxODBCursorObject*, mxODBCursor_Variable*)':
mx/ODBC/Windows/mxODBC.cpp:1115: error: `min' undeclared (first use this
   function)
mx/ODBC/Windows/mxODBC.cpp:1115: error: (Each undeclared identifier is
reported
   only once for each function it appears in.)
mx/ODBC/Windows/mxODBC.cpp: In function `PyObject*
   mxODBC_UnicodeFromString(mxODBCursorObject*, mxODBCursor_Variable*)':
mx/ODBC/Windows/mxODBC.cpp:1176: error: `min' undeclared (first use this
   function)
mx/ODBC/Windows/mxODBC.cpp: In function `int
   mxODBCursor_AllocateOutputVars(mxODBCursorObject*)':
mx/ODBC/Windows/mxODBC.cpp:2660: error: invalid conversion from `
   PyObject*(*)(mxODBCursorObject*, mxODBCursor_Variable*)' to `void*'
[ ... lots more of these ...]
mx/ODBC/Windows/mxODBC.cpp:2951: error: invalid conversion from `
   PyObject*(*)(mxODBCursorObject*, mxODBCursor_Variable*)' to `void*'
mx/ODBC/Windows/mxODBC.cpp:2970: error: `min' undeclared (first use this
   function)
mx/ODBC/Windows/mxODBC.cpp:2981: error: invalid conversion from `
   PyObject*(*)(mxODBCursorObject*, mxODBCursor_Variable*)' to `void*'
mx/ODBC/Windows/mxODBC.cpp:3002: error: invalid conversion from `
   PyObject*(*)(mxODBCursorObject*, mxODBCursor_Variable*)' to `void*'
mx/ODBC/Windows/mxODBC.cpp:3033: error: invalid conversion from `
   PyObject*(*)(mxODBCursorObject*, mxODBCursor_Variable*)' to `void*'
mx/ODBC/Windows/mxODBC.cpp: In function `int
   mxODBCursor_BindInputParameter(mxODBCursorObject*,
mxODBCursor_Variable*,
   PyObject*, int, int)':
mx/ODBC/Windows/mxODBC.cpp:4225: error: `min' undeclared (first use this
   function)
mx/ODBC/Windows/mxODBC.cpp: At global scope:
mx/ODBC/Windows/mxODBC.cpp:5799: error: redefinition of `PyMethodDef
   mxODBCursor_Methods[]'
mx/ODBC/Windows/mxODBC.cpp:593: error: `<typeprefixerror>
mxODBCursor_Methods'
   previously declared here
mx/ODBC/Windows/mxODBC.cpp:5870: error: storage size of `mxODBC_Methods'
isn't
   known
mx/ODBC/Windows/mxODBC.cpp:5870: error: storage size of `mxODBC_Methods'
isn't
   known
mx/ODBC/Windows/mxODBC.cpp: In function `PyObject*
mxODBC_getinfo(PyObject*,
   PyObject*)':
mx/ODBC/Windows/mxODBC.cpp:6308: error: `min' undeclared (first use this
   function)
mx/ODBC/Windows/mxODBC.cpp: At global scope:
mx/ODBC/Windows/mxODBC.cpp:6528: error: redefinition of `PyMethodDef
   mxODBC_Methods[]'
mx/ODBC/Windows/mxODBC.cpp:5870: error: `<typeprefixerror>
mxODBC_Methods'
   previously declared here
mx/ODBC/Windows/mxODBC.cpp: In function `void initmxODBC()':
mx/ODBC/Windows/mxODBC.cpp:6726: warning: comparison between signed and
   unsigned integer expressions
mx/ODBC/Windows/mxODBC.cpp:6727: warning: comparison between signed and
   unsigned integer expressions
mx/ODBC/Windows/mxODBC.cpp:6796: warning: comparison between signed and
   unsigned integer expressions
mx/ODBC/Windows/mxODBC.cpp:6812: warning: comparison between signed and
   unsigned integer expressions
mx/ODBC/Windows/mxODBC.cpp: At top level:
mx/ODBC/Windows/mxODBC.cpp:5799: warning: `PyMethodDef
mxODBCursor_Methods[26]'
   defined but not used
mx/ODBC/Windows/mxODBC.cpp:6528: warning: `PyMethodDef
mxODBC_Methods[9]'
   defined but not used
error: command 'gcc' failed with exit status 1

I notice that sys.platform is checked for a "windows-like" value in
mx/ODBC/Misc/test.py, mx/stdlib/distutils/mxSetup.py, and mxSetup.py but
I'm not really able to say whether these uses need to change. Much of it
seems to be about picking up the MS VC libraries, which shouldn't be
relevant to mx.ODBC.Windows, I'd have thought:

./mx/ODBC/Misc/test.py
2122:        if sys.platform == 'win32':
./mx/stdlib/distutils/mxSetup.py
233:        Only available on Windows platforms with installed compiler.
269:# are environment variables used on Windows platforms, other
platforms
275:if sys.platform[:3] == 'win':
444:        if sys.platform[:5] == 'win32':
1612:        # Default to <platform>-py<version> on all platforms
1614:            self.plat_name = '%s-py%s' % (get_platform(),
sys.version[:3])
./mxCOMMERCIAL.py
58:if sys.platform[:3] == 'win' or sys.platform[-3:] == 'win':
92:if sys.platform[:3] == 'win' or sys.platform[-3:] == 'win':
170:if sys.platform[:3] == 'win' or sys.platform[-3:] == 'win':
./mxSetup.py
233:        Only available on Windows platforms with installed compiler.
269:# are environment variables used on Windows platforms, other
platforms
275:if sys.platform[:3] == 'win':
444:        if sys.platform[:5] == 'win32':
1614:            self.plat_name = '%s-py%s' % (get_platform(),
sys.version[:3])

Does that Holden guy know what he was talking about? ;-)

regards
--
Steve Holden          +1 703 278 8281        http://www.holdenweb.com/
Improve the Internet           http://vancouver-webpages.com/CacheNow/
Python Web Programming                http://pydish.holdenweb.com/pwp/
Interview with GvR August 14, 2003       http://www.onlamp.com/python/






More information about the egenix-users mailing list