Обсуждение: how to build extensions when not on 9.3?

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

how to build extensions when not on 9.3?

От
Jeff Frost
Дата:
I ran into a problem trying to build pg_repack via the pgxn install tool on Ubuntu 14.04 with Postgresql 9.2 installed
fromapt.postgresql.org. 

It seems that postgresql-server-dev-9.2 drags libpq-dev-9.3 along with it and the subsequent compiles fail.

Couldn't find any 9.2 libpq-dev versions.

Found this old thread for 12.04 and 9.1 without a resolution:

http://www.postgresql.org/message-id/53989C91.6050403@pinpointresearch.com

ri  libpq-dev                           9.3.4-1.pgdg14.04+1           amd64        header files for libpq5 (PostgreSQL
library)
ri  libpq5                              9.3.4-1.pgdg14.04+1           amd64        PostgreSQL C client library
ii  pgdg-keyring                        2013.2                        all          keyring for apt.postgresql.org
ii  postgresql-9.2                      9.2.8-1.pgdg14.04+1           amd64        object-relational SQL database,
version9.2 server 
ii  postgresql-client-9.2               9.2.8-1.pgdg14.04+1           amd64        front-end programs for PostgreSQL
9.2
ii  postgresql-client-common            154.pgdg14.04+1               all          manager for multiple PostgreSQL
clientversions 
ii  postgresql-common                   154.pgdg14.04+1               all          PostgreSQL database-cluster manager
ii  postgresql-contrib-9.2              9.2.8-1.pgdg14.04+1           amd64        additional facilities for PostgreSQL
ii  postgresql-server-dev-9.2           9.2.8-1.pgdg14.04+1           amd64        development files for PostgreSQL 9.2
server-sideprogramming 

jfrost@db3.production:~$ pgxn install pg_repack --sudo
INFO: best version: pg_repack 1.2.1
INFO: saving /tmp/tmpz6wkuQ/pg_repack-1.2.1.zip
INFO: unpacking: /tmp/tmpz6wkuQ/pg_repack-1.2.1.zip
INFO: building extension
make[1]: Entering directory `/tmp/tmpz6wkuQ/pg_repack-1.2.1/bin'
gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIC -pie
-I/usr/include/mit-krb5-DLINUX_OOM_ADJ=0 -fno-omit-frame-pointer -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement-Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv
-fexcess-precision=standard-g -I/usr/include/postgresql -DREPACK_VERSION=1.2.1 -I. -I./
-I/usr/include/postgresql/9.2/server-I/usr/include/postgresql/internal -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
-I/usr/include/libxml2 -I/usr/include/tcl8.6  -c -o pg_repack.o pg_repack.c 
In file included from pgut/pgut.h:21:0,
                 from pgut/pgut-fe.h:13,
                 from pg_repack.c:25:
/usr/include/postgresql/libpq-fe.h:547:1: error: unknown type name ‘pg_int64’
 extern pg_int64 lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence);
 ^
/usr/include/postgresql/libpq-fe.h:547:50: error: unknown type name ‘pg_int64’
 extern pg_int64 lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence);
                                                  ^
/usr/include/postgresql/libpq-fe.h:551:1: error: unknown type name ‘pg_int64’
 extern pg_int64 lo_tell64(PGconn *conn, int fd);
 ^
/usr/include/postgresql/libpq-fe.h:553:48: error: unknown type name ‘pg_int64’
 extern int lo_truncate64(PGconn *conn, int fd, pg_int64 len);
                                                ^
make[1]: *** [pg_repack.o] Error 1
make[1]: Leaving directory `/tmp/tmpz6wkuQ/pg_repack-1.2.1/bin'
make: *** [all] Error 2
ERROR: command returned 2: make PG_CONFIG=/usr/bin/pg_config all

Verified that's the correct pg_config:

jfrost@db3.production:~$ /usr/bin/pg_config
BINDIR = /usr/lib/postgresql/9.2/bin
DOCDIR = /usr/share/doc/postgresql-doc-9.2
HTMLDIR = /usr/share/doc/postgresql-doc-9.2
INCLUDEDIR = /usr/include/postgresql
PKGINCLUDEDIR = /usr/include/postgresql
INCLUDEDIR-SERVER = /usr/include/postgresql/9.2/server
LIBDIR = /usr/lib
PKGLIBDIR = /usr/lib/postgresql/9.2/lib
LOCALEDIR = /usr/share/locale
MANDIR = /usr/share/postgresql/9.2/man
SHAREDIR = /usr/share/postgresql/9.2
SYSCONFDIR = /etc/postgresql-common
PGXS = /usr/lib/postgresql/9.2/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--with-tcl' '--with-perl' '--with-python' '--with-pam' '--with-krb5' '--with-gssapi' '--with-openssl'
'--with-libxml''--with-libxslt' '--with-ldap' '--with-tclconfig=/usr/lib/x86_64-linux-gnu/tcl8.6'
'--with-includes=/usr/include/tcl8.6''PYTHON=/usr/bin/python' '--mandir=/usr/share/postgresql/9.2/man'
'--docdir=/usr/share/doc/postgresql-doc-9.2''--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share/'
'--datadir=/usr/share/postgresql/9.2''--bindir=/usr/lib/postgresql/9.2/bin' '--libdir=/usr/lib/'
'--libexecdir=/usr/lib/postgresql/''--includedir=/usr/include/postgresql/' '--enable-nls' '--enable-integer-datetimes'
'--enable-thread-safety''--enable-debug' '--disable-rpath' '--with-ossp-uuid' '--with-gnu-ld' '--with-pgport=5432'
'--with-system-tzdata=/usr/share/zoneinfo''CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security-fPIC -pie -I/usr/include/mit-krb5 -DLINUX_OOM_ADJ=0 -fno-omit-frame-pointer'
'LDFLAGS=-Wl,-Bsymbolic-functions-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -L/usr/lib/mit-krb5
-L/usr/lib/x86_64-linux-gnu/mit-krb5''CPPFLAGS=-D_FORTIFY_SOURCE=2' 
CC = gcc
CPPFLAGS = -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/tcl8.6
CFLAGS = -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIC -pie
-I/usr/include/mit-krb5-DLINUX_OOM_ADJ=0 -fno-omit-frame-pointer -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement-Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv
-fexcess-precision=standard-g 
CFLAGS_SL = -fpic
LDFLAGS = -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -L/usr/lib/mit-krb5
-L/usr/lib/x86_64-linux-gnu/mit-krb5-Wl,--as-needed 
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lkrb5 -lcom_err -lgssapi_krb5 -lz -ledit -lcrypt -ldl -lm
VERSION = PostgreSQL 9.2.8



---
Jeff Frost <jeff@pgexperts.com>
CTO, PostgreSQL Experts, Inc.
Phone: 1-888-PG-EXPRT x506
FAX: 415-762-5122
http://www.pgexperts.com/





Re: how to build extensions when not on 9.3?

От
Jeff Frost
Дата:
On Jul 1, 2014, at 4:41 PM, Jeff Frost <jeff@pgexperts.com> wrote:

> I ran into a problem trying to build pg_repack via the pgxn install tool on Ubuntu 14.04 with Postgresql 9.2
installedfrom apt.postgresql.org. 
>
> It seems that postgresql-server-dev-9.2 drags libpq-dev-9.3 along with it and the subsequent compiles fail.
>
> Couldn't find any 9.2 libpq-dev versions.
>
> Found this old thread for 12.04 and 9.1 without a resolution:
>
> http://www.postgresql.org/message-id/53989C91.6050403@pinpointresearch.com
>
> ri  libpq-dev                           9.3.4-1.pgdg14.04+1           amd64        header files for libpq5
(PostgreSQLlibrary) 
> ri  libpq5                              9.3.4-1.pgdg14.04+1           amd64        PostgreSQL C client library
> ii  pgdg-keyring                        2013.2                        all          keyring for apt.postgresql.org
> ii  postgresql-9.2                      9.2.8-1.pgdg14.04+1           amd64        object-relational SQL database,
version9.2 server 
> ii  postgresql-client-9.2               9.2.8-1.pgdg14.04+1           amd64        front-end programs for PostgreSQL
9.2
> ii  postgresql-client-common            154.pgdg14.04+1               all          manager for multiple PostgreSQL
clientversions 
> ii  postgresql-common                   154.pgdg14.04+1               all          PostgreSQL database-cluster
manager
> ii  postgresql-contrib-9.2              9.2.8-1.pgdg14.04+1           amd64        additional facilities for
PostgreSQL
> ii  postgresql-server-dev-9.2           9.2.8-1.pgdg14.04+1           amd64        development files for PostgreSQL
9.2server-side programming 
>
> jfrost@db3.production:~$ pgxn install pg_repack --sudo
> INFO: best version: pg_repack 1.2.1
> INFO: saving /tmp/tmpz6wkuQ/pg_repack-1.2.1.zip
> INFO: unpacking: /tmp/tmpz6wkuQ/pg_repack-1.2.1.zip
> INFO: building extension
> make[1]: Entering directory `/tmp/tmpz6wkuQ/pg_repack-1.2.1/bin'
> gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIC -pie
-I/usr/include/mit-krb5-DLINUX_OOM_ADJ=0 -fno-omit-frame-pointer -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement-Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv
-fexcess-precision=standard-g -I/usr/include/postgresql -DREPACK_VERSION=1.2.1 -I. -I./
-I/usr/include/postgresql/9.2/server-I/usr/include/postgresql/internal -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
-I/usr/include/libxml2 -I/usr/include/tcl8.6  -c -o pg_repack.o pg_repack.c 
> In file included from pgut/pgut.h:21:0,
>                 from pgut/pgut-fe.h:13,
>                 from pg_repack.c:25:
> /usr/include/postgresql/libpq-fe.h:547:1: error: unknown type name ‘pg_int64’
> extern pg_int64 lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence);
> ^
> /usr/include/postgresql/libpq-fe.h:547:50: error: unknown type name ‘pg_int64’
> extern pg_int64 lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence);
>                                                  ^
> /usr/include/postgresql/libpq-fe.h:551:1: error: unknown type name ‘pg_int64’
> extern pg_int64 lo_tell64(PGconn *conn, int fd);
> ^
> /usr/include/postgresql/libpq-fe.h:553:48: error: unknown type name ‘pg_int64’
> extern int lo_truncate64(PGconn *conn, int fd, pg_int64 len);
>                                                ^
> make[1]: *** [pg_repack.o] Error 1
> make[1]: Leaving directory `/tmp/tmpz6wkuQ/pg_repack-1.2.1/bin'
> make: *** [all] Error 2
> ERROR: command returned 2: make PG_CONFIG=/usr/bin/pg_config all
>
> Verified that's the correct pg_config:
>
> jfrost@db3.production:~$ /usr/bin/pg_config
> BINDIR = /usr/lib/postgresql/9.2/bin
> DOCDIR = /usr/share/doc/postgresql-doc-9.2
> HTMLDIR = /usr/share/doc/postgresql-doc-9.2
> INCLUDEDIR = /usr/include/postgresql
> PKGINCLUDEDIR = /usr/include/postgresql
> INCLUDEDIR-SERVER = /usr/include/postgresql/9.2/server
> LIBDIR = /usr/lib
> PKGLIBDIR = /usr/lib/postgresql/9.2/lib
> LOCALEDIR = /usr/share/locale
> MANDIR = /usr/share/postgresql/9.2/man
> SHAREDIR = /usr/share/postgresql/9.2
> SYSCONFDIR = /etc/postgresql-common
> PGXS = /usr/lib/postgresql/9.2/lib/pgxs/src/makefiles/pgxs.mk
> CONFIGURE = '--with-tcl' '--with-perl' '--with-python' '--with-pam' '--with-krb5' '--with-gssapi' '--with-openssl'
'--with-libxml''--with-libxslt' '--with-ldap' '--with-tclconfig=/usr/lib/x86_64-linux-gnu/tcl8.6'
'--with-includes=/usr/include/tcl8.6''PYTHON=/usr/bin/python' '--mandir=/usr/share/postgresql/9.2/man'
'--docdir=/usr/share/doc/postgresql-doc-9.2''--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share/'
'--datadir=/usr/share/postgresql/9.2''--bindir=/usr/lib/postgresql/9.2/bin' '--libdir=/usr/lib/'
'--libexecdir=/usr/lib/postgresql/''--includedir=/usr/include/postgresql/' '--enable-nls' '--enable-integer-datetimes'
'--enable-thread-safety''--enable-debug' '--disable-rpath' '--with-ossp-uuid' '--with-gnu-ld' '--with-pgport=5432'
'--with-system-tzdata=/usr/share/zoneinfo''CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security-fPIC -pie -I/usr/include/mit-krb5 -DLINUX_OOM_ADJ=0 -fno-omit-frame-pointer'
'LDFLAGS=-Wl,-Bsymbolic-functions-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -L/usr/lib/mit-krb5
-L/usr/lib/x86_64-linux-gnu/mit-krb5''CPPFLAGS=-D_FORTIFY_SOURCE=2' 
> CC = gcc
> CPPFLAGS = -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/tcl8.6
> CFLAGS = -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIC -pie
-I/usr/include/mit-krb5-DLINUX_OOM_ADJ=0 -fno-omit-frame-pointer -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement-Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv
-fexcess-precision=standard-g 
> CFLAGS_SL = -fpic
> LDFLAGS = -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -L/usr/lib/mit-krb5
-L/usr/lib/x86_64-linux-gnu/mit-krb5-Wl,--as-needed 
> LDFLAGS_EX =
> LDFLAGS_SL =
> LIBS = -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lkrb5 -lcom_err -lgssapi_krb5 -lz -ledit -lcrypt -ldl -lm
> VERSION = PostgreSQL 9.2.8
>

Anyone have any ideas here?  I opened a github issue with the pg_repack maintainer, but he didn't have a better idea
thanme. 

Is there a reason that we only provide a 9.3 libpq-dev?

https://github.com/reorg/pg_repack/issues/27

Is the answer just install from source if you're not on 9.3 and need to install extensions?




Re: how to build extensions when not on 9.3?

От
Dimitri Fontaine
Дата:
Jeff Frost <jeff@pgexperts.com> writes:
>> It seems that postgresql-server-dev-9.2 drags libpq-dev-9.3 along
>> with it and the subsequent compiles fail.

Sorry to only see that now, but it seems to me that your question is
answered in the FAQ:

  http://wiki.postgresql.org/wiki/Apt/FAQ#I_want_libpq5_for_version_X.2C_but_there_is_only_version_Y_in_the_repository

Namely in your case you should tweak your sources.list entry like this:

  deb http://apt.postgresql.org/pub/repos/apt/ squeeze-pgdg main 9.2

> Is there a reason that we only provide a 9.3 libpq-dev?

My (limited) understanding here is that the libpq package provides both
server side and client side components, and for client side components
all you need is the most recent libpq around.

Where I need some more facts is on the server-side parts that are to be
found in libpq-dev, I think that's a bug.

Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support


Re: how to build extensions when not on 9.3?

От
Christoph Berg
Дата:
Re: Jeff Frost 2014-07-24 <69FA86B8-E8BA-4BD4-8EF1-63A92E5EA149@pgexperts.com>
> Anyone have any ideas here?  I opened a github issue with the pg_repack maintainer, but he didn't have a better idea
thanme. 
>
> Is there a reason that we only provide a 9.3 libpq-dev?
>
> https://github.com/reorg/pg_repack/issues/27
>
> Is the answer just install from source if you're not on 9.3 and need to install extensions?

Sorry for the non-answer via mail so far.

As said on IRC, everything else works. We are building lots of server-
side extensions for various PG versions in parallel, all using the
9.3 libpq5 and libpq-dev.

There are/were some knows problems where the client headers depend on the
server, though that should be a different issue.

I haven't had time to look into pg_repack yet. Possibly I can come up
with a solution once these minor releases are out of the door.

Re: Dimitri Fontaine 2014-07-24 <m2iomnkz3h.fsf@2ndQuadrant.fr>
> Jeff Frost <jeff@pgexperts.com> writes:
> >> It seems that postgresql-server-dev-9.2 drags libpq-dev-9.3 along
> >> with it and the subsequent compiles fail.
>
> Sorry to only see that now, but it seems to me that your question is
> answered in the FAQ:
>
>
http://wiki.postgresql.org/wiki/Apt/FAQ#I_want_libpq5_for_version_X.2C_but_there_is_only_version_Y_in_the_repository
>
> Namely in your case you should tweak your sources.list entry like this:
>
>   deb http://apt.postgresql.org/pub/repos/apt/ squeeze-pgdg main 9.2

Ack.

> > Is there a reason that we only provide a 9.3 libpq-dev?
>
> My (limited) understanding here is that the libpq package provides both
> server side and client side components, and for client side components
> all you need is the most recent libpq around.

Right, plus postgresql-server-dev-<version>.

> Where I need some more facts is on the server-side parts that are to be
> found in libpq-dev, I think that's a bug.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=314427
http://www.postgresql.org/message-id/20140426122548.GA7249@msgid.df7cb.de

Christoph
--
cb@df7cb.de | http://www.df7cb.de/


Re: how to build extensions when not on 9.3?

От
Jeff Frost
Дата:

On Jul 24, 2014, at 12:14 AM, Dimitri Fontaine <dimitri@2ndQuadrant.fr> wrote:

Sorry to only see that now, but it seems to me that your question is
answered in the FAQ:

 http://wiki.postgresql.org/wiki/Apt/FAQ#I_want_libpq5_for_version_X.2C_but_there_is_only_version_Y_in_the_repository

Namely in your case you should tweak your sources.list entry like this:

 deb http://apt.postgresql.org/pub/repos/apt/ squeeze-pgdg main 9.2

Not sure how I missed this in the docs, but that got me going like so:

sudo apt-get install postgresql-server-dev-9.2 postgresql-9.2 postgresql-9.2-postgis-2.1 postgresql-9.2-slony1-2 postgresql-contrib-9.2 postgresql-client-9.2 libpq-dev=9.2.9-1.pgdg14.04+1 libpq5=9.2.9-1.pgdg14.04+1 pgxnclient

Then I had to install a couple other -dev packages and pg_repack built just fine.

Thanks!