Segfault-Inc / Multicorn

Data Access Library
https://multicorn.org/
PostgreSQL License
699 stars 145 forks source link

pgxn install fails (Python 2.7; Ubuntu 16.04) #209

Open EOSIT opened 6 years ago

EOSIT commented 6 years ago

After a successful sudo apt install pgxnclient, I tried sudo pgxn install multicorn and got this error:

INFO: best version: multicorn 1.3.5
INFO: saving /tmp/tmpDSC6W6/multicorn-1.3.5.zip
INFO: unpacking: /tmp/tmpDSC6W6/multicorn-1.3.5.zip
INFO: building extension
Python version is 2.7
[ -d sql ] || mkdir sql
[ -d src ] || mkdir src
touch directories.stamp
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -I/usr/include/mit-krb5 -fPIC -pie -fno-omit-frame-pointer -fPIC -I. -I./ -I/usr/include/python2.7 -I. -I./ -I/usr/include/postgresql/9.5/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/tcl8.6  -c -o src/errors.o src/errors.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -I/usr/include/mit-krb5 -fPIC -pie -fno-omit-frame-pointer -fPIC -I. -I./ -I/usr/include/python2.7 -I. -I./ -I/usr/include/postgresql/9.5/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/tcl8.6  -c -o src/python.o src/python.c
src/python.c: In function ‘getCacheEntry’:
src/python.c:567:16: error: ‘ALLOCSET_SMALL_SIZES’ undeclared (first use in this function)
                ALLOCSET_SMALL_SIZES),
                ^
src/python.c:567:16: note: each undeclared identifier is reported only once for each function it appears in
src/python.c:565:30: error: too few arguments to function ‘AllocSetContextCreate’
  MemoryContext tempContext = AllocSetContextCreate(CurrentMemoryContext,
                              ^
In file included from src/python.c:13:0:
/usr/include/postgresql/9.5/server/utils/memutils.h:131:22: note: declared here
 extern MemoryContext AllocSetContextCreate(MemoryContext parent,
                      ^
<builtin>: recipe for target 'src/python.o' failed
make: *** [src/python.o] Error 1
ERROR: command returned 2: make PG_CONFIG=/usr/bin/pg_config all
phrrngtn commented 6 years ago

Have you tried building it from a git clone? I have got this to work with 9.6 and 10.1 by making sure that the PATH is set to pick up the appropriate version of pg_config. Are you stuck on 9.5?

bozerkins commented 5 years ago

Any solution to this? Got the same error

phrrngtn commented 5 years ago

I believe that if you compile HEAD against PostgreSQL 9.6 or more recent, it will build and work correctly. If you must stay on an earlier revision, then one can try to backport the missing macros e.g.

define ALLOCSET_SMALL_SIZES \

    ALLOCSET_SMALL_MINSIZE, ALLOCSET_SMALL_INITSIZE, ALLOCSET_SMALL_MAXSIZE

However, I did not try to do this so I don't know if it can work. I have had no problems at all with building and using the extension with 10.1

pjjH

bozerkins commented 5 years ago

compiling from source (via git clone) actually fixes the issue. thanks!

skamensky commented 5 years ago

I also had trouble installing using pgxn. I tried building from master on this repo but got some errors.

Ubuntu:9.6 PostgreSQL:11.1

errors on make:

(venv) root@2f4138288daf:/tmp/multi/Multi/Multicorn# make
Python version is 2.7
[ -d sql ] || mkdir sql
[ -d src ] || mkdir src
touch directories.stamp
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -I. -I./ -I/usr/include/python2.7 -I. -I./ -I/usr/include/postgresql/11/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o src/errors.o src/errors.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -I. -I./ -I/usr/include/python2.7 -I. -I./ -I/usr/include/postgresql/11/server -I/usr/include/postgresql/internal  -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include/mit-krb5  -c -o src/python.o src/python.c
src/python.c: In function ‘getColumnsFromTable’:
src/python.c:462:28: error: incompatible types when initializing type ‘Form_pg_attribute {aka struct FormData_pg_attribute *}’ using type ‘FormData_pg_attribute {aka struct FormData_pg_attribute}’
    Form_pg_attribute att = desc->attrs[i];
                            ^~~~
src/python.c: In function ‘pythonDictToTuple’:
src/python.c:1217:28: error: incompatible types when initializing type ‘Form_pg_attribute {aka struct FormData_pg_attribute *}’ using type ‘FormData_pg_attribute {aka struct FormData_pg_attribute}’
   Form_pg_attribute attr = slot->tts_tupleDescriptor->attrs[i];
                            ^~~~
src/python.c: In function ‘pythonSequenceToTuple’:
src/python.c:1266:28: error: incompatible types when initializing type ‘Form_pg_attribute {aka struct FormData_pg_attribute *}’ using type ‘FormData_pg_attribute {aka struct FormData_pg_attribute}’
   Form_pg_attribute attr = slot->tts_tupleDescriptor->attrs[i];
                            ^~~~
src/python.c: In function ‘tupleTableSlotToPyObject’:
src/python.c:1661:28: error: incompatible types when initializing type ‘Form_pg_attribute {aka struct FormData_pg_attribute *}’ using type ‘FormData_pg_attribute {aka struct FormData_pg_attribute}’
   Form_pg_attribute attr = tupdesc->attrs[i];
                            ^~~~~~~
<builtin>: recipe for target 'src/python.o' failed
make: *** [src/python.o] Error 1