problems compiling pyscopg2 on Windows with Python 2.6

Chris Withers <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
Hi All,

Well, ain't I just a glutton for punishment ;-)

Okay, so I have Postgresql 8.4 installed from binary on Win XP.
I have Python 2.6.2, I also have MinGW 5.1.6 and MS VC++ Express 2008.

When trying to build with the MS compiler, I get the errors at the end 
of this email.

Building with MinGW works fine, but then when I try to import, I get:

 >>> import psycopg2
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "C:\Python26\lib\site-packages\psycopg2\__init__.py", line 60, 
in <module>
     from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: DLL load failed: The specified procedure could not be found.

After playing around with a dependency checker, I think I'm bumping into 
this problem:

http://bugs.python.org/issue3308

...for which there seems to be no resolution.

Does anyone have any ideas as to how to get psycopg2 working on Windows?

cheers,

Chris

PS: The MS VC++ errors:

connection_type.c
psycopg\connection_type.c(366) : warning C4013: 'pq_reset' undefined; 
assuming extern returning int
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo 
/Ox /MD /W3 /GS- /DNDEBUG -DPSYCOPG_D
EFAULT_PYDATETIME=1 "-DPSYCOPG_VERSION=\"2.0.12 (dt dec ext pq3)\"" 
-DPG_VERSION_HEX=0x080401 -DPSYCOPG_EXT
ENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 
-DHAVE_PQPROTOCOL3=1 -IC:\Python26\include -IC:\Python
26\PC -I. -IC:/PROGRA~1/POSTGR~1/8.4/include 
-IC:/PROGRA~1/POSTGR~1/8.4/include/server /Tcpsycopg\connectio
n_int.c /Fobuild\temp.win32-2.6\Release\psycopg\connection_int.obj /Wp64
cl : Command line warning D9035 : option 'Wp64' has been deprecated and 
will be removed in a future release

connection_int.c
psycopg\connection_int.c(69) : error C2143: syntax error : missing ';' 
before 'type'
psycopg\connection_int.c(71) : error C2065: 'notice' : undeclared identifier
psycopg\connection_int.c(71) : warning C4047: '!=' : 'int' differs in 
levels of indirection from 'void *'
psycopg\connection_int.c(72) : error C2065: 'notice' : undeclared identifier
psycopg\connection_int.c(72) : error C2223: left of '->message' must 
point to struct/union
psycopg\connection_int.c(72) : error C2198: 'PyString_FromString' : too 
few arguments for call
psycopg\connection_int.c(74) : error C2065: 'notice' : undeclared identifier
psycopg\connection_int.c(74) : error C2223: left of '->message' must 
point to struct/union
psycopg\connection_int.c(83) : error C2065: 'notice' : undeclared identifier
psycopg\connection_int.c(83) : error C2065: 'notice' : undeclared identifier
psycopg\connection_int.c(83) : error C2223: left of '->next' must point 
to struct/union
psycopg\connection_int.c(96) : error C2143: syntax error : missing ';' 
before 'type'
psycopg\connection_int.c(98) : error C2065: 'notice' : undeclared identifier
psycopg\connection_int.c(98) : warning C4047: '!=' : 'int' differs in 
levels of indirection from 'void *'
psycopg\connection_int.c(99) : error C2065: 'tmp' : undeclared identifier
psycopg\connection_int.c(99) : error C2065: 'notice' : undeclared identifier
psycopg\connection_int.c(100) : error C2065: 'notice' : undeclared 
identifier
psycopg\connection_int.c(100) : error C2065: 'notice' : undeclared 
identifier
psycopg\connection_int.c(100) : error C2223: left of '->next' must point 
to struct/union
psycopg\connection_int.c(101) : error C2065: 'tmp' : undeclared identifier
psycopg\connection_int.c(101) : error C2223: left of '->message' must 
point to struct/union
psycopg\connection_int.c(101) : error C2198: 'free' : too few arguments 
for call
psycopg\connection_int.c(102) : error C2065: 'tmp' : undeclared identifier
psycopg\connection_int.c(102) : warning C4022: 'free' : pointer mismatch 
for actual parameter 1
error: command '"C:\Program Files\Microsoft Visual Studio 
9.0\VC\BIN\cl.exe"' failed with exit status 2

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.