UKOUG Technology Conference

UKOUG Technology Conference
UKOUG Technology Conference 2018 Call for Papers

Monday, July 04, 2016

Install PostGIS on Solaris 11 (11.3)

I said I would install PostGIS for a student project but I wish I never said yes, since it has taken over a week to compile it.

As you may guess there are not many working instruction out in the wild!

I will break down this step-by-step guide into different blogs entries otherwise it will get very long.
I had to compile all software using GCC since Solaris Studio gave to many problems:

libtool: compile:  /opt/developerstudio12.5/bin/CC -m64 -DHAVE_CONFIG_H -I. -I../../include -I../../include/geos -I../../include -m64 -DGEOS_INLINE -pedantic -Wall -ansi -Wno-long-long -m64 -c ConvexHull.cpp  -KPIC -DPIC -o .libs/ConvexHull.o
CC: Warning: Option -ansi passed to ld, if ld is invoked, ignored otherwise
"ConvexHull.cpp", line 121: Warning: inputPts hides geos::algorithm::ConvexHull::inputPts.
"ConvexHull.cpp", line 160: Warning: inputPts hides geos::algorithm::ConvexHull::inputPts.
"ConvexHull.cpp", line 211: Error: Could not find a match for std::vector::assign(__rwstd::__rb_tree, geos::geom::CoordinateLessThen, std::allocator>::const_iterator, __rwstd::__rb_tree, geos::geom::CoordinateLessThen, std::allocator>::const_iterator) needed in geos::algorithm::ConvexHull::reduce(std::vector&).
1 Error(s) and 2 Warning(s) detected.

Compile PostGIS

# pkg install developer/gcc-45 build/gnu-make
# pkg install libtool automake autoconf gnu-gettext library/libxml2 library/json-c
# export PATH=/usr/gcc/4.5/bin:/usr/bin:/usr/sbin:/usr/sfw/bin:/usr/lib:/usr/gnu/bin:

# gzip -dc postgis-2.2.2.tar.gz  | tar xf -
# cd postgis-2.2.2

See the following for a fix for undeclared NAN. "'NAN' undeclared (first use in this function)"

# ./configure CC='gcc -m64' CFLAGS='-m64 -DNAN="(0.0/0.0)"' LDFLAGS='-L/usr/local/postgres/9.53-pgdg/lib/64' CXX='g++ -m64' \
    --prefix=/usr/local/postgres/postgis \
    --with-pgconfig=/usr/local/postgres/9.53-pgdg/bin/64/pg_config \
    --with-geosconfig=/usr/local/postgres/geos/bin/geos-config \
    --with-gdalconfig=/usr/local/postgres/gdal/bin/gdal-config \
    --with-projdir=/usr/local/postgres/proj4

...
config.status: executing po-directories commands

  PostGIS is now configured for x86_64-pc-solaris2.11

 -------------- Compiler Info -------------
  C compiler:           gcc -m64 -m64 -DNAN="(0.0/0.0)"
  SQL preprocessor:     /usr/gcc/4.5/bin/cpp -traditional-cpp -w -P

 -------------- Dependencies --------------
  GEOS config:          /usr/local/postgres/geos/bin/geos-config
  GEOS version:         3.5.0
  GDAL config:          /usr/local/postgres/gdal/bin/gdal-config
  GDAL version:         2.1.0
  PostgreSQL config:    /usr/local/postgres/9.53-pgdg/bin/64/pg_config
  PostgreSQL version:   PostgreSQL 9.5.3
  PROJ4 version:        49
  Libxml2 config:       /usr/bin/xml2-config
  Libxml2 version:      2.9.4
  JSON-C support:       yes
  PCRE support:         no
  PostGIS debug level:  0
  Perl:                 /usr/bin/perl

 --------------- Extensions ---------------
  PostGIS Raster:       enabled
  PostGIS Topology:     enabled
  SFCGAL support:       disabled
  Address Standardizer support:       disabled

 -------- Documentation Generation --------
  xsltproc:             /usr/bin/xsltproc
  xsl style sheets:    
  dblatex:             
  convert:             
  mathml2.dtd:          http://www.w3.org/Math/DTD/mathml2/mathml2.dtd


# gmake
# gmake install

Any updates or additions  please let me know so that I can keep this pages up to date.

6 comments:

Andrew Watkins said...

Some addition information from postgis-devel mail lists:
- pkgsrc builds from Joyent https://github.com/joyent/pkgsrc/tree/trunk/databases/postgresql-postgis2 this look very interesting
- Solaris 10 build script using OpenCSW https://github.com/pramsey/suite-solaris-build/blob/master/pgsql-postgis-gdal-build.sh

Andrew Watkins said...

I have added 2 new posts about how to compile some of the above using Oracle Developer Studio 12.5:
Compile Proj4 reprojection library on Solaris 11 using Oracle Developer Studio 12.5 : http://notallmicrosoft.blogspot.co.uk/2016/07/compile-proj4-reprojection-library-on.html
and
Compile GEOS geometry library on Solaris 11 using Oracle Developer Studio 12.5 : http://notallmicrosoft.blogspot.co.uk/2016/07/compile-geos-geometry-library-on.html

Danielle Felder said...

Nice post. Would love to add your Solaris review on IT Central Station. Other users like it a lot as well: https://goo.gl/ijRUds.

Andrew Watkins said...

That sounds like a great idea.

Handojo said...

Hi Andrew,

You had a very resourceful blog here.

I tried to compile Postgis as your instruction,

the CC succeed, but the gmake fails with this error :

Unable to locate target new version number in postgis.sql
gmake[1]: *** [Makefile:189: postgis_upgrade.sql.in] Error 255
gmake[1]: *** Deleting file 'postgis_upgrade.sql.in'
gmake[1]: Leaving directory '/home/handojoh/Downloads/postgis/postgis-2.3.1/postgis'
gmake: *** [GNUmakefile:16: all] Error 1


Is it possible to consult personally ? I can't seem to find your email here.

Regards,

Handojo

Andrew Watkins said...

Handojo,

I haven't touch it since I did the blog, but I just went through teh steps again with the latest version and no errors.

Have you checked your path: export PATH=/usr/gcc/4.5/bin:/usr/bin:/usr/sbin:/usr/sfw/bin:/usr/lib:/usr/gnu/bin:

# cpp --version
cpp (GCC) 4.5.2
# gcc --version
gcc (GCC) 4.5.2

This link https://trac.osgeo.org/postgis/ticket/3506 shows the same error which may help.

Andrew