Monday, July 04, 2016

Compile PostgreSQL on Solaris 11 (11.3)

I know PostgreSQL is available as a binary from http://www.postgresql.org and to be honest I have always used it but just in case you need to go down the PostGIS route then you may need to recompile it.

References: PostgreSQL 9.5.3 Documentation

# pkg install developer/gcc-45 build/gnu-make
# export PATH=/usr/gcc/4.5/bin:/usr/bin:/usr/sbin:/usr/sfw/bin:/usr/lib:/usr/gnu/bin:
# bzip2 -dc postgresql-9.5.3.tar.bz2 | tar xf -
# cd postgresql-9.5.3

I have tried to follow the same setup as you get from the binary version:
# ./configure CC='gcc -m64' \
     --prefix=/usr/local/postgres/9.53-pgdg \
      --bindir=/usr/local/postgres/9.53-pgdg/bin/64 \
      --docdir=/usr/local/postgres/9.53-pgdg/doc \
      --htmldir=/usr/local/postgres/9.53-pgdg/doc \
      --includedir=/usr/local/postgres/9.53-pgdg/include/64 \
      --libdir=/usr/local/postgres/9.53-pgdg/lib/64 \
      --localedir=/usr/local/postgres/9.53-pgdg/share/locale \
      --mandir=/usr/local/postgres/9.53-pgdg/man \
      --datarootdir=/usr/local/postgres/9.53-pgdg/share \
      --sysconfdir=/usr/local/postgres/9.53-pgdg/etc \
      --with-libxml --with-libxslt --with-pam --with-openssl \
      --with-gssapi


# gmake
# gmake install 

Check the configuration:
# /usr/local/postgres/9.53-pgdg/bin/64/pg_config
BINDIR = /usr/local/postgres/9.53-pgdg/bin/64
DOCDIR = /usr/local/postgres/9.53-pgdg/doc
HTMLDIR = /usr/local/postgres/9.53-pgdg/doc
INCLUDEDIR = /usr/local/postgres/9.53-pgdg/include/64
PKGINCLUDEDIR = /usr/local/postgres/9.53-pgdg/include/64
INCLUDEDIR-SERVER = /usr/local/postgres/9.53-pgdg/include/64/server
LIBDIR = /usr/local/postgres/9.53-pgdg/lib/64
PKGLIBDIR = /usr/local/postgres/9.53-pgdg/lib/64
LOCALEDIR = /usr/local/postgres/9.53-pgdg/share/locale
MANDIR = /usr/local/postgres/9.53-pgdg/man
SHAREDIR = /usr/local/postgres/9.53-pgdg/share
SYSCONFDIR = /usr/local/postgres/9.53-pgdg/etc
PGXS = /usr/local/postgres/9.53-pgdg/lib/64/pgxs/src/makefiles/pgxs.mk
CONFIGURE = 'CC=gcc -m64' '--prefix=/usr/local/postgres/9.53-pgdg' '--bindir=/usr/local/postgres/9.53-pgdg/bin/64' '--docdir=/usr/local/postgres/9.53-pgdg/doc' '--htmldir=/usr/local/postgres/9.53-pgdg/doc' '--includedir=/usr/local/postgres/9.53-pgdg/include/64' '--libdir=/usr/local/postgres/9.53-pgdg/lib/64' '--localedir=/usr/local/postgres/9.53-pgdg/share/locale' '--mandir=/usr/local/postgres/9.53-pgdg/man' '--datarootdir=/usr/local/postgres/9.53-pgdg/share' '--sysconfdir=/usr/local/postgres/9.53-pgdg/etc' '--with-libxml' '--with-libxslt' '--with-pam' '--with-openssl' '--with-gssapi'
CC = gcc -m64
CPPFLAGS = -I/usr/include/libxml2
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2
CFLAGS_SL = -fPIC
LDFLAGS = -L../../../src/common -Wl,--as-needed -Wl,-R'/usr/local/postgres/9.53-pgdg/lib/64'
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lgss -lz -lreadline -ltermcap -lnsl -lsocket -lm
VERSION = PostgreSQL 9.5.3

That's it. Please check my blog entry Install PostgreSQL on Solaris 11 (11.3) about configuration.

No comments:

Post a Comment