Обсуждение: syntax error with connection.h and more in build

Поиск
Список
Период
Сортировка

syntax error with connection.h and more in build

От
"David Sloboda"
Дата:
I'm unable to get psycopg2-2.4 to build on Red Hat Enterprise Linux
release 4 update 8

./psycopg/connection.h and other files throw syntax errors.
connection.h is straight from the tarbal and does not appear to have a
syntax error to me.

I have the postgresql-devel and other RPMs installed.

I've read http://initd.org/psycopg/docs/faq.html
  I am not getting the "No such file or directory" errors mentioned in
the FAQ.

I'm stuck.  Any assistance would be most appreciated.  Thanks.

[root@bby1log01 psycopg2-2.4]# /usr/bin/pg_config --version
PostgreSQL 7.4.30
[root@bby1log01 psycopg2-2.4]# cat /etc/issue
Red Hat Enterprise Linux WS release 4 (Nahant Update 8)
Kernel \r on an \m

[root@bby1log01 psycopg2-2.4]# uname -a
Linux bby1log01.pmc-sierra.bc.ca 2.6.9-89.0.26.ELhugemem #1 SMP Sun May
30 09:43:09 EDT 2010 i686 i686 i386 GNU/Linux
[root@bby1log01 psycopg2-2.4]#
[root@bby1log01 psycopg2-2.4]# rpm -qa | grep postgres
postgresql-devel-7.4.30-1.el4_8.2
postgresql-libs-7.4.30-1.el4_8.2
postgresql-7.4.30-1.el4_8.2
[root@bby1log01 psycopg2-2.4]#
/usr/opt/pmc/python/python-2.7.1/bin/python setup.py build
running build
running build_py
creating build
creating build/lib.linux-i686-2.7
creating build/lib.linux-i686-2.7/psycopg2
copying lib/errorcodes.py -> build/lib.linux-i686-2.7/psycopg2
copying lib/psycopg1.py -> build/lib.linux-i686-2.7/psycopg2
copying lib/__init__.py -> build/lib.linux-i686-2.7/psycopg2
copying lib/extensions.py -> build/lib.linux-i686-2.7/psycopg2
copying lib/pool.py -> build/lib.linux-i686-2.7/psycopg2
copying lib/tz.py -> build/lib.linux-i686-2.7/psycopg2
copying lib/extras.py -> build/lib.linux-i686-2.7/psycopg2
creating build/lib.linux-i686-2.7/psycopg2/tests
copying tests/test_dates.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/test_copy.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/testconfig.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/test_psycopg2_dbapi20.py ->
build/lib.linux-i686-2.7/psycopg2/tests
copying tests/test_notify.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/test_cancel.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/test_transaction.py ->
build/lib.linux-i686-2.7/psycopg2/tests
copying tests/test_lobject.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/__init__.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/bug_gc.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/test_async.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/types_extras.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/test_quote.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/testutils.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/types_basic.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/extras_dictcursor.py ->
build/lib.linux-i686-2.7/psycopg2/tests
copying tests/test_connection.py ->
build/lib.linux-i686-2.7/psycopg2/tests
copying tests/dbapi20_tpc.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/dbapi20.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/test_green.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/test_cursor.py -> build/lib.linux-i686-2.7/psycopg2/tests
copying tests/bugX000.py -> build/lib.linux-i686-2.7/psycopg2/tests
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-i686-2.7
creating build/temp.linux-i686-2.7/psycopg
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall
-Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1
-DPSYCOPG_VERSION="2.4 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x07041E
-DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1
-I/usr/opt/pmc/python/python-2.7.1/include/python2.7 -I. -I/usr/include
-I/usr/include/pgsql/server -c psycopg/psycopgmodule.c -o
build/temp.linux-i686-2.7/psycopg/psycopgmodule.o
-Wdeclaration-after-statement
In file included from psycopg/psycopgmodule.c:29:
./psycopg/connection.h:100: error: syntax error before "PGcancel"
./psycopg/connection.h:100: warning: no semicolon at end of struct or
union
./psycopg/connection.h:120: error: syntax error before '}' token
./psycopg/connection.h:120: warning: type defaults to `int' in
declaration of `connectionObject'
./psycopg/connection.h:120: warning: data definition has no type or
storage class
./psycopg/connection.h:123: error: syntax error before '*' token
...
more omitted
...
In file included from psycopg/psycopgmodule.c:36:
./psycopg/microprotocols.h:56: error: syntax error before
"connectionObject"
./psycopg/microprotocols.h:56: warning: function declaration isn't a
prototype
psycopg/psycopgmodule.c: In function `psyco_register_type':
psycopg/psycopgmodule.c:289: error: dereferencing pointer to incomplete
type
psycopg/psycopgmodule.c:292: error: syntax error before ')' token
psycopg/psycopgmodule.c: In function `psyco_set_error':
psycopg/psycopgmodule.c:598: error: `conn' undeclared (first use in this
function)
psycopg/psycopgmodule.c:598: error: (Each undeclared identifier is
reported only once
psycopg/psycopgmodule.c:598: error: for each function it appears in.)
psycopg/psycopgmodule.c:601: error: dereferencing pointer to incomplete
type
error: command 'gcc' failed with exit status 1
[root@bby1log01 psycopg2-2.4]#

[root@bby1log01 psycopg2-2.4]# grep -in -A3 -B3 PGcancel
./psycopg/connection.h
97-    int server_version;       /* server version */
98-
99-    PGconn *pgconn;           /* the postgresql connection */
100:    PGcancel *cancel;         /* the cancellation structure */
101-
102-    PyObject *async_cursor;   /* weakref to a cursor executing an
asynchronous query */
103-    int async_status;         /* asynchronous execution status */
--
125-HIDDEN int  conn_get_isolation_level(PGresult *pgres);
126-HIDDEN int  conn_get_protocol_version(PGconn *pgconn);
127-HIDDEN int  conn_get_server_version(PGconn *pgconn);
128:HIDDEN PGcancel *conn_get_cancel(PGconn *pgconn);
129-HIDDEN void conn_notice_process(connectionObject *self);
130-HIDDEN void conn_notice_clean(connectionObject *self);
131-HIDDEN void conn_notifies_process(connectionObject *self);
[root@bby1log01 psycopg2-2.4]#

Thanks for your time and attention,
David Sloboda



Re: syntax error with connection.h and more in build

От
"A.M."
Дата:
On May 3, 2011, at 5:55 PM, David Sloboda wrote:

> I'm unable to get psycopg2-2.4 to build on Red Hat Enterprise Linux
> release 4 update 8
>
> ./psycopg/connection.h and other files throw syntax errors.
> connection.h is straight from the tarbal and does not appear to have a
> syntax error to me.
>
> I have the postgresql-devel and other RPMs installed.
>
> I've read http://initd.org/psycopg/docs/faq.html
>  I am not getting the "No such file or directory" errors mentioned in
> the FAQ.
>
> I'm stuck.  Any assistance would be most appreciated.  Thanks.

It looks like you're trying to build against postgresql 7.4. Try building psycopg2 against postgresql 9.0 client libs
instead.You can then use the 9.0 lib to connect to the 7.4 database. I don't know enough about RHEL to tell you if can
installthe different postgresql versions side-by-side. Adjust your path to pop in the 9.0 pg_config, and the build
shouldsucceed. 

Cheers,
M