Tuesday, January 2, 2018

Compile GEOS geometry library on Solaris 11 using Oracle Developer Studio 12 5

Compile GEOS geometry library on Solaris 11 using Oracle Developer Studio 12 5


This is a follow on from my posts about installing PostGIS in those posts I used GNU compilers, but I have managed to get parts to compile with Developer Studio 12.5.

If you are looking for the GNU version then it is here: Compile PostgreGIS (GEOS geometry library) on Solaris 11 (11.3) using gcc

# pkg install build/gnu-make text/gnu-patch
# pkg install libtool automake autoconf gnu-gettext library/libxml2 library/json-c
# export PATH=/opt/developerstudio12.5/bin:/usr/bin:/usr/sbin:/usr/sfw/bin:/usr/lib:/usr/gnu/bin:
# bzip2 -dc geos-3.5.0.tar.bz2| tar xf -
  • I have taken the information from "Need to compile the libGeos using Sun Studio12 on Solaris10" and created the following 3 patches:
    • Solaris RW libCstd workarounds: geos-3.5.0-libCstd_hacks-1.patch
    • Another RW libCstd workaround so that you can --enable-cassert: geos-3.5.0-cassert_libCstd_hack-1.patch
    • RW libCstd workarounds for the geos testsuit: geos-3.5.0-testsuite_libCstd_hacks-1.patch
  • Used "GEOS build fails on linking on Solaris" to make sure I add -lm to the LIBS 
  • Also added -lCrun -lCstd to LIBS
  • Added "__C99FEATURES__" so C99 support is added. 
  • Fixed an error in geos-3.5.0/tests/perf/Makefile.in "LIBS = $(top_builddir)/src/libgeos.la" (believe fixed in SVN version)
    • Quick patch for geos-3.5.0 tests/perf/Makefile.in
    • # patch -p1 < geos-3.5.0-testsuite-Makefile.patch 
  • Finally there is a error in the way configure checks flags for CC: Bug logged: configure is incorrectly test C compiler flags and not C++ flags (configure.in needs fixing)
    • Dirty fix is to remove  -ansi flag checking from configure
# cd  geos-3.5.0
# patch -p1 < geos-3.5.0-cassert_libCstd_hack-1.patch
patching file include/geos/geomgraph/NodeMap.h
# patch -p1 < geos-3.5.0-libCstd_hacks-1.patch
patching file src/algorithm/ConvexHull.cpp
patching file include/geos/geom/CoordinateList.h
patching file src/operation/overlay/OverlayOp.cpp
patching file src/operation/overlay/PolygonBuilder.cpp
# patch -p1 < geos-3.5.0-testsuite_libCstd_hacks-1.patch
patching file tests/unit/geos_unit.cpp
patching file tests/unit/operation/union/CascadedPolygonUnionTest.cpp
patching file tests/xmltester/XMLTester.cpp

# ./configure CC=cc CXX=CC -D__C99FEATURES__ CPPFLAGS=-m64 CXXFLAGS=-m64 LIBS=-lm -lCrun -lCstd --disable-inline --enable-cassert

# gmake
# gmake install


visit link download