Monday, July 11, 2016

Compile Proj4 reprojection 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 (Proj4 reprojection library) on Solaris 11 (11.3) using gcc

# pkg install build/gnu-make 
# 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:

# unzip -q 
# cd proj.4-master
# autoreconf -vif
autoreconf: Entering directory `.'
autoreconf: not using Gettext
autoreconf: running: aclocal --force -I m4
autoreconf: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `.'.
libtoolize: copying file `./'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing installing `./config.guess' installing `./config.sub' installing `./install-sh' installing `./missing'
src/ installing `./depcomp'
autoreconf: Leaving directory `.'

./configure CC='cc -m64 -D_XOPEN_SOURCE=600' CXX='CC -m64'  CPPFLAGS=-m64 CXXFLAGS=-m64 --prefix=/usr/local/postgres/proj4s
# gmake
# gmake install
As you can see the main difference is I am using _XOPEN_SOURCE=600 which tells the compiler to include definitions for some extra functions that are defined in the X/Open and POSIX standards.

Without the above you would see the following errors:
/bin/sh ../libtool --tag=CC   --mode=compile cc -m64 -DHAVE_CONFIG_H -I.  -DPROJ_LIB=\"/usr/local/postgres/proj4/share/proj\" -DMUTEX_pthread  -m64 -Wall -Wdeclaration-after-statement -g -c -o pj_mutex.lo pj_mutex.c
libtool: compile:  cc -m64 -DHAVE_CONFIG_H -I. "-DPROJ_LIB=\"/usr/local/postgres/proj4/share/proj\"" -DMUTEX_pthread -m64 -Wall -Wdeclaration-after-statement -g -c pj_mutex.c  -KPIC -DPIC -o .libs/pj_mutex.o
"/usr/include/sys/feature_tests.h", line 354: #error: "Compiler or options invalid for pre-UNIX 03 X/Open applications  and pre-2001 POSIX applications"
cc: acomp failed for pj_mutex.c
gmake[2]: *** [pj_mutex.lo] Error 1
gmake[2]: Leaving directory `/tmp/proj.4-master/src'
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory `/tmp/proj.4-master/src'
gmake: *** [all-recursive] Error 1

No comments: