Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create extension fails #17

Closed
edmenendez opened this issue Jun 21, 2019 · 4 comments
Closed

Create extension fails #17

edmenendez opened this issue Jun 21, 2019 · 4 comments

Comments

@edmenendez
Copy link

edmenendez commented Jun 21, 2019

Using Docker image postgres:10.8. I install it this way.

apt-get update
apt-get install -y gcc git vim postgresql-server-dev-all postgresql-common
# This rm is required so that pg_config doesn't refer to the wrong directory.
rm -f -r /usr/lib/postgresql/11 
cd /tmp
git clone https://github.com/postgrespro/zson.git zson
cd zson
make
make install
make installcheck

installcheck fails because it's trying to connect using sockets. This is probably OK? However, when I psql to the server and try to create the extension I get this:

postgres=# create extension zson;
ERROR:  could not open extension control file "/usr/local/share/postgresql/extension/zson.control": No such file or directory

When I search the file, this is where I find it

root@d76a8502d69c:/tmp/zson# find / -name zson.control
/tmp/zson/zson.control
/usr/share/postgresql/10/extension/zson.control
@edmenendez
Copy link
Author

This is the output of pg_config

root@d76a8502d69c:/tmp/zson# pg_config
BINDIR = /usr/lib/postgresql/10/bin
DOCDIR = /usr/share/doc/postgresql-doc-10
HTMLDIR = /usr/share/doc/postgresql-doc-10
INCLUDEDIR = /usr/include/postgresql
PKGINCLUDEDIR = /usr/include/postgresql
INCLUDEDIR-SERVER = /usr/include/postgresql/10/server
LIBDIR = /usr/lib/x86_64-linux-gnu
PKGLIBDIR = /usr/lib/postgresql/10/lib
LOCALEDIR = /usr/share/locale
MANDIR = /usr/share/postgresql/10/man
SHAREDIR = /usr/share/postgresql/10
SYSCONFDIR = /etc/postgresql-common
PGXS = /usr/lib/postgresql/10/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=/usr/include' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--disable-silent-rules' '--libdir=/usr/lib/x86_64-linux-gnu' '--libexecdir=/usr/lib/x86_64-linux-gnu' '--disable-maintainer-mode' '--disable-dependency-tracking' '--with-icu' '--with-tcl' '--with-perl' '--with-python' '--with-pam' '--with-openssl' '--with-libxml' '--with-libxslt' 'PYTHON=/usr/bin/python' '--mandir=/usr/share/postgresql/10/man' '--docdir=/usr/share/doc/postgresql-doc-10' '--sysconfdir=/etc/postgresql-common' '--datarootdir=/usr/share/' '--datadir=/usr/share/postgresql/10' '--bindir=/usr/lib/postgresql/10/bin' '--libdir=/usr/lib/x86_64-linux-gnu/' '--libexecdir=/usr/lib/postgresql/' '--includedir=/usr/include/postgresql/' '--with-extra-version= (Debian 10.9-1.pgdg90+1)' '--enable-nls' '--enable-integer-datetimes' '--enable-thread-safety' '--enable-tap-tests' '--enable-debug' '--enable-dtrace' '--disable-rpath' '--with-uuid=e2fs' '--with-gnu-ld' '--with-pgport=5432' '--with-system-tzdata=/usr/share/zoneinfo' '--with-systemd' '--with-selinux' 'MKDIR_P=/bin/mkdir -p' 'TAR=/bin/tar' 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer' 'LDFLAGS=-Wl,-z,relro -Wl,-z,now' '--with-gssapi' '--with-ldap' '--with-includes=/usr/include/mit-krb5' '--with-libs=/usr/lib/mit-krb5' '--with-libs=/usr/lib/x86_64-linux-gnu/mit-krb5' 'build_alias=x86_64-linux-gnu' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2'
CC = gcc
CPPFLAGS = -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/mit-krb5
CFLAGS = -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
CFLAGS_SL = -fPIC
LDFLAGS = -Wl,-z,relro -Wl,-z,now -L/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,--as-needed
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lpthread -lselinux -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -ledit -lrt -lcrypt -ldl -lm
VERSION = PostgreSQL 10.9 (Debian 10.9-1.pgdg90+1)

@edmenendez
Copy link
Author

I tried with postgres 11.4 and got the same results.

@edmenendez
Copy link
Author

In my case the issue was quite simple. Although I created everything manually in a docker bash session.. it was missing from the docker image where the DB was actually running. When I go to CREATE EXTENSION, postgres can't find any of the files.

If you're setting it up in docker, this might help someone. You need to add this to the DockerFile for the DB.

FROM postgres:11.4 RUN apt-get update RUN apt-get install -y protobuf-c-compiler libprotobuf-c0-dev vim wget make postgresql-server-dev-11 libpq-dev gcc git sudo WORKDIR /tmp/ RUN git clone https://github.com/postgrespro/zson.git WORKDIR /tmp/zson RUN make RUN ["make", "install"]

@afiskon
Copy link
Collaborator

afiskon commented Apr 21, 2021

@edmenendez Many thanks for sharing this!

@afiskon afiskon closed this as completed Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants