Hello.
Yesterday I had problems getting repmgr installed, since our
PostgreSQL installs to a non-standard place, and doesn't use any
postgresql repositories/packages. The responses I got generally
seemed to be 'you need to compile it'.
Time for round 2, trying to compile it with our own environment.
Many apologies if I'm doing something obviously stupid, I have
*very little* experience with compiling things on linux.
To speed things up I'm doing my attempted compiles on my laptop
instead of our servers, since I can install packages etc as
required myself without having to wait on our tech support team. I
want to verify that I can get repmgr up and running on as minimal
a test server as I can before rolling it out to slightly more
hefty boxes :)
I'm running ubuntu server 17.04. The EnterpriseDB installer was
used to quickly install a quick test PostgreSQL db, "testdb" under
owning userid "testdb". Here is the output of pg_config:
testdb@repm:/postgresql/software/repmgr/repmgr-3.3.1$ pg_config
BINDIR = /postgresql/software/pg/9.6.2/bin
DOCDIR = /postgresql/software/pg/9.6.2/doc/postgresql
HTMLDIR = /postgresql/software/pg/9.6.2/doc/postgresql
INCLUDEDIR = /postgresql/software/pg/9.6.2/include
PKGINCLUDEDIR = /postgresql/software/pg/9.6.2/include/postgresql
INCLUDEDIR-SERVER =
/postgresql/software/pg/9.6.2/include/postgresql/server
LIBDIR = /postgresql/software/pg/9.6.2/lib
PKGLIBDIR = /postgresql/software/pg/9.6.2/lib/postgresql
LOCALEDIR = /postgresql/software/pg/9.6.2/share/locale
MANDIR = /postgresql/software/pg/9.6.2/share/man
SHAREDIR = /postgresql/software/pg/9.6.2/share/postgresql
SYSCONFDIR = /postgresql/software/pg/9.6.2/etc/postgresql
PGXS =
/postgresql/software/pg/9.6.2/lib/postgresql/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--enable-debug' '--with-libs=/opt/local/Current/lib'
'--with-includes=/opt/local/Current/include/libxml2:/opt/local/Current/include'
'--prefix=/mnt/hgfs/pginstaller.auto/server/staging/linux-x64'
'--with-ldap' '--with-openssl' '--with-perl' '--with-python'
'--with-tcl'
'--with-tclconfig=/opt/local/EnterpriseDB/LanguagePack/9.6/Tcl-8.5/lib'
'--with-pam' '--enable-thread-safety' '--with-libxml'
'--with-ossp-uuid'
'--docdir=/mnt/hgfs/pginstaller.auto/server/staging/linux-x64/doc/postgresql'
'--with-libxslt' '--with-libedit-preferred' '--with-gssapi'
'LD_LIBRARY_PATH=/opt/local/Current/lib' 'CFLAGS=-O2
-DMAP_HUGETLB=0x40000'
CC = gcc
CPPFLAGS = -DFRONTEND -D_GNU_SOURCE
-I/opt/local/Current/include/libxml2 -I/opt/local/Current/include
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
-fwrapv -g -O2 -DMAP_HUGETLB=0x40000
CFLAGS_SL = -fpic
LDFLAGS = -L../../src/common -L/opt/local/Current/lib
-Wl,--as-needed
-Wl,-rpath,'/mnt/hgfs/pginstaller.auto/server/staging/linux-x64/lib',--enable-new-dtags
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto
-lgssapi_krb5 -lz -ledit -lrt -lcrypt -ldl -lm
VERSION = PostgreSQL 9.6.2
testdb@repm:/postgresql/software/repmgr/repmgr-3.3.1$
PostgreSQL is up and running nicely:
testdb@repm:/postgresql/software/repmgr/repmgr-3.3.1$ pg_ctl
status
pg_ctl: server is running (PID: 1433)
/postgresql/software/pg/9.6.2/bin/postgres
First attempt at compilation was unsuccessful and so I followed the
advice in PACKAGES.md:When building repmgr against a Debian packages
build, you may discover that some development packages are needed as
well. You will need the following development packages installed:
sudo apt-get install libxslt-dev libxml2-dev libpam-dev libedit-dev
Here's the output I now get when checking those packages:
testdb@repm:/postgresql/software/repmgr/repmgr-3.3.1$ sudo
apt-get install libxslt-dev libxml2-dev libpam-dev libedit-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libxslt1-dev' instead of 'libxslt-dev'
Note, selecting 'libpam0g-dev' instead of 'libpam-dev'
libedit-dev is already the newest version (3.1-20160903-3).
libpam0g-dev is already the newest version (1.1.8-3.2ubuntu2).
libxml2-dev is already the newest version (2.9.4+dfsg1-2.2).
libxslt1-dev is already the newest version (1.1.29-2ubuntu0.1).
0 to upgrade, 0 to newly install, 0 to remove and 4 not to
upgrade.
It also recommends installing the postgres server dev
sudo apt-get install postgresql-server-dev-9.0
testdb@repm:/postgresql/software/repmgr/repmgr-3.3.1$ sudo
apt-get install postgresql-server-dev-9.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
postgresql-server-dev-9.6 is already the newest version (9.6.2-1).
0 to upgrade, 0 to newly install, 0 to remove and 4 not to
upgrade.
Already installed for 9.6 - had to install it for pg_config.
So I've already got installed the packages that PACKAGES.MD
recommends, I guess. Attempts to compile repmgr are now failing
with:
(In the directory with the expanded tar file):
testdb@repm:/postgresql/software/repmgr/repmgr-3.3.1$ ls
check_dir.c compat.h CONTRIBUTING.md dbutils.c dirmod.c
errcode.h HISTORY log.h QUICKSTART.md
repmgr.conf.sample repmgr.sql strutil.c uninstall_repmgr.sql
check_dir.h config.c COPYRIGHT dbutils.h dirmod.h
FAILOVER.rst LICENSE Makefile README.md
repmgrd.c sql strutil.h version.h
compat.c config.h CREDITS debian docs
FAQ.md log.c PACKAGES.md repmgr.c
repmgr.h SSH-RSYNC.md TODO)
testdb@repm:/postgresql/software/repmgr/repmgr-3.3.1$ sudo make
USE_PGXS=1 install
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
-fdebug-prefix-map=/build/postgresql-9.6-jQU1kx/postgresql-9.6-9.6.2=.
-fstack-protector-strong -Wformat -Werror=format-security
-I/usr/include/mit-krb5 -fPIC -pie -fno-omit-frame-pointer
-I/usr/include/postgresql -I. -I./
-I/usr/include/postgresql/9.6/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
dbutils.o dbutils.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
-fdebug-prefix-map=/build/postgresql-9.6-jQU1kx/postgresql-9.6-9.6.2=.
-fstack-protector-strong -Wformat -Werror=format-security
-I/usr/include/mit-krb5 -fPIC -pie -fno-omit-frame-pointer
-I/usr/include/postgresql -I. -I./
-I/usr/include/postgresql/9.6/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
config.o config.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
-fdebug-prefix-map=/build/postgresql-9.6-jQU1kx/postgresql-9.6-9.6.2=.
-fstack-protector-strong -Wformat -Werror=format-security
-I/usr/include/mit-krb5 -fPIC -pie -fno-omit-frame-pointer
-I/usr/include/postgresql -I. -I./
-I/usr/include/postgresql/9.6/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
repmgrd.o repmgrd.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
-fdebug-prefix-map=/build/postgresql-9.6-jQU1kx/postgresql-9.6-9.6.2=.
-fstack-protector-strong -Wformat -Werror=format-security
-I/usr/include/mit-krb5 -fPIC -pie -fno-omit-frame-pointer
-I/usr/include/postgresql -I. -I./
-I/usr/include/postgresql/9.6/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
log.o log.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
-fdebug-prefix-map=/build/postgresql-9.6-jQU1kx/postgresql-9.6-9.6.2=.
-fstack-protector-strong -Wformat -Werror=format-security
-I/usr/include/mit-krb5 -fPIC -pie -fno-omit-frame-pointer
-I/usr/include/postgresql -I. -I./
-I/usr/include/postgresql/9.6/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
strutil.o strutil.c
gcc -o repmgrd -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
-fdebug-prefix-map=/build/postgresql-9.6-jQU1kx/postgresql-9.6-9.6.2=.
-fstack-protector-strong -Wformat -Werror=format-security
-I/usr/include/mit-krb5 -fPIC -pie -fno-omit-frame-pointer
dbutils.o config.o repmgrd.o log.o strutil.o
-L/usr/lib/x86_64-linux-gnu -lpgcommon -lpgport
-L/usr/lib/x86_64-linux-gnu -lpq -L/usr/lib/x86_64-linux-gnu
-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 -lpgcommon -lpgport -lselinux -lxslt -lxml2 -lpam
-lssl -lcrypto -lgssapi_krb5 -lz -ledit -lrt -lcrypt -ldl -lm
/usr/bin/ld: cannot find -lselinux
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
/usr/bin/ld: cannot find -lgssapi_krb5
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
Makefile:20: recipe for target 'repmgrd' failed
make: *** [repmgrd] Error 1
Any ideas what I am doing wrong? I can only assume I'm missing
something really, really, obvious. Every single book and article
I've seen simply states 'Just quickly install repmgr then ...' -
it's driving me nuts that I can't get this thing installed, let
alone working :)
Any help/advice/suggestions/pointing-outs-of-the-obvious would be
greatly appreciated.
Regards,
Martin.
--
Martin Goodson
"Have you thought up some clever plan, Doctor?"
"Yes, Jamie, I believe I have."
"What're you going to do?"
"Bung a rock at it."