Re: problems compiling pyscopg2 on Windows with Python 2.6

Jason Erickson <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
The MinGW error is possibly because it cannot load a shared DLL, and so it 
stops and gives the error message you are seeing.  If you look into the 
Windows Event Viewer, you should be able to see what DLL is not loading 
(and what version it is looking for) and possibly be able to fix it. 
Worst case, there might be an incompatibility between the standard runtime 
libraries that Python uses and the libraries that MinGW uses, which if 
that is the case would require you to rebuild Python (all all the 
extensions you use) with MinGW.

The Visual C errors are because declarations of variables need to be at 
the start of the function (for VC anyways), and a few updates have added 
new pointers declarations not quite at the beginning.  I have neglected to 
push up a patch (yes, bad jason), since I haven't taken the time to 
install and learn git.  I suppose it is time for me to bite the bullet, 
as I've put it off long enough.

And if you are looking for pre-built binaries for windows, you can check 
here :)
 	http://www.stickpeople.com/projects/python/psycopg/

Note that you may get the same error as you did with the MinGW if the 
following MS Update is not installed (For the Py2.6 version):
 	http://www.microsoft.com/downloads/details.aspx?familyid=766A6AF7-EC73-40FF-B072-9112BAB119C2&displaylang=en

Ideally, this update should not be necessary.  I need to figure out why 
it is requiring it.

-jason



On Sat, 26 Sep 2009, Chris Withers wrote:

> 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
> _______________________________________________
> Psycopg mailing list
> Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
> http://lists.initd.org/mailman/listinfo/psycopg
>
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.