Build issues in psycopg.h (PGConn)

Jorgen Austvik - Sun Norway <Jorgen.Austvik-UdXhSnd/[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Organization Sun Microsystems Database Group, Norway
Message-ID <[email protected]>
Hi,

I am seeing some build issues for psycopg.h:

Linux:
--------8<-------------8<-------------8<-------------8<-------------8<-------------8<-----
/usr/bin/gcc <snip> -c psycopg/psycopgmodule.c -o 
build/temp.linux-x86_64-2.4/psycopg/psycopgmodule.o
In file included from psycopg/psycopgmodule.c:28:
./psycopg/psycopg.h:145: error: expected declaration specifiers or '...' 
before 'PGconn'
error: command '/usr/bin/gcc' failed with exit status 1
--------8<-------------8<-------------8<-------------8<-------------8<-------------8<-----

Solaris:
--------8<-------------8<-------------8<-------------8<-------------8<-------------8<-----
/usr/lib/python2.4/pycc <snip> -o build/temp.solaris-2.11-i86pc-2.4
/psycopg/psycopgmodule.o
"./psycopg/psycopg.h", line 145: syntax error before or at: PGconn
"./psycopg/psycopg.h", line 145: warning: undefined or missing type for: 
PGconn
"psycopg/psycopgmodule.c", line 110: warning: initializer does not fit 
or is out of range: -1
cc: acomp failed for psycopg/psycopgmodule.c
error: command '/usr/lib/python2.4/pycc' failed with exit status 2
--------8<-------------8<-------------8<-------------8<-------------8<-------------8<-----

The following patch fixes the issue for me:
--------8<-------------8<-------------8<-------------8<-------------8<-------------8<-----
=== modified file 'psycopg/psycopg.h'
--- psycopg/psycopg.h   2008-07-26 13:09:20 +0000
+++ psycopg/psycopg.h   2008-07-29 08:30:32 +0000
@@ -25,6 +25,7 @@
  #define PY_SSIZE_T_CLEAN
  #include <Python.h>

+#include <libpq-fe.h>
  #include "psycopg/config.h"

  #ifdef __cplusplus
--------8<-------------8<-------------8<-------------8<-------------8<-------------8<-----

(bzr revno: 360)

-J
-- 

Jørgen Austvik, Software Engineering - QA
Sun Microsystems Database Group

http://blogs.sun.com/austvik/
http://www.austvik.net/
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.