Bug 192840 - json-c 0.12 breaks gdal and postgis
Summary: json-c 0.12 breaks gdal and postgis
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: John Marino
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-19 22:26 UTC by Luca Corti
Modified: 2014-08-22 19:43 UTC (History)
6 users (show)

See Also:


Attachments
config.log (179.22 KB, text/plain)
2014-08-19 22:30 UTC, Luca Corti
no flags Details
patch for postgis-2.1.3 (5.13 KB, patch)
2014-08-20 06:09 UTC, Muhammad Moinur Rahman
no flags Details | Diff
Patch for raster header file. (399 bytes, patch)
2014-08-21 15:20 UTC, Robert Kruus
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Corti 2014-08-19 22:26:58 UTC
Hello,

upgrading json-c to 0.12 prevents building gdal and postgis21 at least:

===>>> Starting build for databases/postgis21 <<<===

===>>> All dependencies are up to date

===>  Cleaning for postgis-2.1.0_6
===>  License GPLv2 accepted by the user
===>  Found saved configuration for postgis-2.1.0_6
===>   postgis-2.1.0_6 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by postgis-2.1.0_6 for building
===>  Extracting for postgis-2.1.0_6
=> SHA256 Checksum OK for postgis-2.1.0.tar.gz.
===>  Patching for postgis-2.1.0_6
===>   postgis-2.1.0_6 depends on executable: gmake - found
===>   postgis-2.1.0_6 depends on executable: pkgconf - found
===>   postgis-2.1.0_6 depends on file: /usr/local/bin/perl5.16.3 - found
===>   postgis-2.1.0_6 depends on shared library: libproj.so - found (/usr/local/lib/libproj.so.7)
===>   postgis-2.1.0_6 depends on shared library: libgeos.so - found (/usr/local/lib/libgeos-3.4.2.so)
===>   postgis-2.1.0_6 depends on shared library: libjson.so - not found
===>    Verifying for libjson.so in /usr/ports/devel/json-c
===>  Installing for json-c-0.12
===>  Checking if json-c already installed
===>   json-c-0.12 is already installed
      You may wish to ``make deinstall'' and install this port again
      by ``make reinstall'' to upgrade it properly.
      If you really wish to overwrite the old port of json-c
      without deleting it first, set the variable "FORCE_PKG_REGISTER"
      in your environment or the "make install" command line.
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/devel/json-c
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/databases/postgis21
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/postgis21

===>>> make build failed for databases/postgis21
===>>> Aborting update


===>>> You can restart from the point of failure with this command line:
       portmaster <flags> databases/postgis21
Comment 1 Luca Corti 2014-08-19 22:30:57 UTC
Created attachment 146053 [details]
config.log
Comment 2 Luca Corti 2014-08-19 22:36:17 UTC
/usr/ports/databases/postgis21 # make reinstall
===>   postgis-2.1.0_6 depends on executable: gmake - found
===>   postgis-2.1.0_6 depends on executable: pkgconf - found
===>   postgis-2.1.0_6 depends on file: /usr/local/bin/perl5.16.3 - found
===>   postgis-2.1.0_6 depends on shared library: libproj.so - found (/usr/local/lib/libproj.so.7)
===>   postgis-2.1.0_6 depends on shared library: libgeos.so - found (/usr/local/lib/libgeos-3.4.2.so)
===>   postgis-2.1.0_6 depends on shared library: libjson.so - not found
===>    Verifying for libjson.so in /usr/ports/devel/json-c
===>  Installing for json-c-0.12
===>   Registering installation for json-c-0.12 as automatic
===>   Returning to build of postgis-2.1.0_6
===>   postgis-2.1.0_6 depends on shared library: libgdal.so - found (/usr/local/lib/libgdal.so.1.11.0)
===>   postgis-2.1.0_6 depends on shared library: libiconv.so.3 - found (/usr/local/lib/libiconv.so.3)
===>   postgis-2.1.0_6 depends on shared library: libpq.so.5 - found (/usr/local/lib/libpq.so.5)
===>   postgis-2.1.0_6 depends on shared library: libxml2.so - found (/usr/local/lib/libxml2.so.2.9.1)
===>  Configuring for postgis-2.1.0_6
===>   FreeBSD 10 autotools fix applied to /usr/ports/databases/postgis21/work/postgis-2.1.0/config.rpath
===>   FreeBSD 10 autotools fix applied to /usr/ports/databases/postgis21/work/postgis-2.1.0/aclocal.m4
===>   FreeBSD 10 autotools fix applied to /usr/ports/databases/postgis21/work/postgis-2.1.0/libtool
===>   FreeBSD 10 autotools fix applied to /usr/ports/databases/postgis21/work/postgis-2.1.0/configure
===>   FreeBSD 10 autotools fix applied to /usr/ports/databases/postgis21/work/postgis-2.1.0/macros/libtool.m4

  ======================= GEOS Support Notice ========================
  In order to use the GEOS support, you may need to specially compile
  your version of PostgreSQL to link the C++ runtime library.
  To do this, invoke the PostgreSQL Makefile script this way:

  on csh shell:

  setenv LDFLAGS -lstdc++
  make

  on sh or bash shell:

  export LDFLAGS=-lstdc++
  make

  The initial LDFLAGS variable is passed through to the Makefile and
  adds the C++ library to the linking stage.

  ====================================================================

configure: loading site script /usr/ports/Templates/config.site
checking build system type... amd64-portbld-freebsd10.0
checking host system type... amd64-portbld-freebsd10.0
checking for gcc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for grep that handles long lines and -e... (cached) /usr/bin/grep
checking for egrep... (cached) /usr/bin/egrep
checking for fgrep... (cached) /usr/bin/fgrep
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... (cached) 262144
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... no
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from cc object... ok
checking how to run the C preprocessor... cpp
checking for ANSI C header files... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for memory.h... (cached) yes
checking for strings.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for unistd.h... (cached) yes
checking for dlfcn.h... (cached) yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... freebsd10.0 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for gcc... (cached) cc
checking whether we are using the GNU C compiler... (cached) yes
checking whether cc accepts -g... (cached) yes
checking for cc option to accept ISO C89... (cached) none needed
checking how to run the C preprocessor... cpp
checking whether we are using the GNU C++ compiler... yes
checking whether c++ accepts -g... yes
checking if c++ PIC flag -fPIC -DPIC works... yes
checking if c++ static flag -static works... yes
checking if c++ supports -c -o file.o... yes
checking if c++ supports -c -o file.o... (cached) yes
checking whether the c++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... freebsd10.0 ld.so
checking how to hardcode library paths into programs... immediate
checking for grep that handles long lines and -e... (cached) /usr/bin/grep
checking for ant... no
checking for cpp... /usr/bin/cpp
checking if c++ supports -Wall... yes
checking if c++ supports -Wmissing-prototypes... yes
checking if c++ supports -ffloat-store... no
checking for flex... flex
checking lex output file root... lex.yy
checking lex library... -lfl
checking whether yytext is a pointer... yes
checking for bison... bison -y
checking ieeefp.h usability... yes
checking ieeefp.h presence... yes
checking for ieeefp.h... yes
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking for vasprintf... (cached) yes
checking for asprintf... (cached) yes
checking for _LARGEFILE_SOURCE value needed for large files... no
checking for perl... (cached) /usr/local/bin/perl
checking for convert... no
configure: WARNING: ImageMagick does not seem to be installed. Documentation cannot be built
checking for xsltproc... /usr/local/bin/xsltproc
checking for xmllint... /usr/local/bin/xmllint
checking for dblatex... no
configure: WARNING: dblatex is not installed so PDF documentation cannot be built
configure: WARNING: could not locate Docbook stylesheets required to build the documentation
checking CUnit/CUnit.h usability... no
checking CUnit/CUnit.h presence... no
checking for CUnit/CUnit.h... no
configure: WARNING: could not locate CUnit required for unit tests
checking iconv.h usability... yes
checking iconv.h presence... yes
checking for iconv.h... yes
checking for libiconv_open in -liconv... yes
checking for iconvctl... yes
checking for libiconvctl... no
checking for pg_config... /usr/local/bin/pg_config
checking PostgreSQL version... PostgreSQL 9.3.5
checking libpq-fe.h usability... yes
checking libpq-fe.h presence... yes
checking for libpq-fe.h... yes
checking for PQserverVersion in -lpq... yes
------------------------------------------------------------------------
  WARNING: You have set the --prefix to '/usr/local'. But we mostly    
  ignore the --prefix. For your info, using the values determined from 
  /usr/local/bin/pg_config we will be installing:   
    * postgis shared library in /usr/local/lib 
    * postgis SQL files in /usr/local/share/postgresql/contrib/postgis-2.1 
    * postgis executables in /usr/local/bin 
------------------------------------------------------------------------
checking for xml2-config... /usr/local/bin/xml2-config
checking libxml/tree.h usability... yes
checking libxml/tree.h presence... yes
checking for libxml/tree.h... yes
checking libxml/parser.h usability... yes
checking libxml/parser.h presence... yes
checking for libxml/parser.h... yes
checking libxml/xpath.h usability... yes
checking libxml/xpath.h presence... yes
checking for libxml/xpath.h... yes
checking libxml/xpathInternals.h usability... yes
checking libxml/xpathInternals.h presence... yes
checking for libxml/xpathInternals.h... yes
checking for xmlInitParser in -lxml2... yes
checking for geos-config... /usr/local/bin/geos-config
checking GEOS version... 3.4.2
checking geos_c.h usability... yes
checking geos_c.h presence... yes
checking for geos_c.h... yes
checking for initGEOS in -lgeos_c... yes
checking whether gmake sets $(MAKE)... yes
checking for a BSD-compatible install... /usr/bin/install -c -o root -g wheel
checking for a thread-safe mkdir -p... (cached) /bin/mkdir -p
checking whether NLS is requested... yes
checking for msgfmt... /usr/local/bin/msgfmt
checking for gmsgfmt... /usr/local/bin/msgfmt
checking for xgettext... /usr/local/bin/xgettext
checking for msgmerge... /usr/local/bin/msgmerge
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for shared library run path origin... done
checking for CFPreferencesCopyAppValue... no
checking for CFLocaleCopyCurrent... no
checking for GNU gettext in libc... no
checking for iconv... yes
checking for working iconv... yes
checking how to link with libiconv... /usr/local/lib/libiconv.so -Wl,-rpath -Wl,/usr/local/lib
checking for GNU gettext in libintl... yes
checking whether to use NLS... yes
checking where the gettext function comes from... external libintl
checking how to link with libintl... /usr/local/lib/libintl.so -Wl,-rpath -Wl,/usr/local/lib
checking proj_api.h usability... yes
checking proj_api.h presence... no
configure: WARNING: proj_api.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: proj_api.h: proceeding with the compiler's result
checking for proj_api.h... yes
checking for pj_get_release in -lproj... yes
checking json/json.h usability... no
checking json/json.h presence... no
checking for json/json.h... no
checking for json_object_get in -ljson-c... yes
GUI: Build requested, checking for dependencies (GKT+2.0)
checking for pkg-config... /usr/local/bin/pkg-config
checking for GTK+ - version >= 2.8.0... no
*** Could not run GTK+ test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means GTK+ is incorrectly installed.
CPPFLAGS:  -I/usr/local/include  -I/usr/local/include/libxml2 -I/usr/include  -I/usr/local/include
TOPOLOGY: Topology support requested
RASTER: Raster support requested
checking GDAL version... 1.11.0
checking for OGR enabled... yes
checking gdal.h usability... yes
checking gdal.h presence... yes
checking for gdal.h... yes
checking ogr_api.h usability... yes
checking ogr_api.h presence... yes
checking for ogr_api.h... yes
checking cpl_conv.h usability... yes
checking cpl_conv.h presence... yes
checking for cpl_conv.h... yes
checking for library containing GDALAllRegister... no
configure: error: could not find GDAL
===>  Script "configure" failed unexpectedly.
Please report the problem to trevor@bitba.se [maintainer] and attach the
"/usr/ports/databases/postgis21/work/postgis-2.1.0/config.log" including the
output of the failure of your make command. Also, it might be a good idea to
provide an overview of all packages installed on your system (e.g. a
/usr/local/sbin/pkg-static info -g -Ea).
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/databases/postgis21
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/databases/postgis21
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/postgis21
Comment 3 Luca Corti 2014-08-19 22:42:26 UTC
And GDAL:

gmake -C mbtiles install-obj
gmake[4]: Entering directory `/usr/ports/graphics/gdal/work/gdal-1.11.0/frmts/mbtiles'
c++ -O2 -pipe -fPIC -fno-strict-aliasing -fPIC -DHAVE_SSE_AT_COMPILE_TIME  -Wall  -I/usr/local/include/json-c  -I/usr/ports/graphics/gdal/work/gdal-1.11.0/port -I/usr/ports/graphics/gdal/work/gdal-1.11.0/gcore -I/usr/ports/graphics/gdal/work/gdal-1.11.0/alg -I/usr/ports/graphics/gdal/work/gdal-1.11.0/ogr -I/usr/ports/graphics/gdal/work/gdal-1.11.0/ogr/ogrsf_frmts -DOGR_ENABLED -I/usr/local/include -I/usr/ports/graphics/gdal/work/gdal-1.11.0/port -I/usr/local/include -I/usr/local -I/usr/local/include -I/usr/local -I/usr/local/include -I/usr/local -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local -I/usr/local/include -I/usr/local -I/usr/local/include -I/usr -I/usr/include  -I../../ogr -c -o ../o/mbtilesdataset.o mbtilesdataset.cpp
mbtilesdataset.cpp:623:21: error: use of undeclared identifier 'json_tokener_errors'
                    json_tokener_errors[jstok->err],
                    ^
mbtilesdataset.cpp:634:18: warning: 'json_object_object_get' is deprecated [-Wdeprecated-declarations]
        poGrid = json_object_object_get(jsobj, "grid");
                 ^
/usr/local/include/json-c/json_object.h:290:56: note: 'json_object_object_get' declared here
THIS_FUNCTION_IS_DEPRECATED(extern struct json_object* json_object_object_get(struct json_object* obj,
                                                       ^
/usr/local/include/json-c/json_object.h:17:43: note: expanded from macro 'THIS_FUNCTION_IS_DEPRECATED'
#define THIS_FUNCTION_IS_DEPRECATED(func) func __attribute__ ((deprecated))
                                          ^
mbtilesdataset.cpp:704:35: warning: 'json_object_object_get' is deprecated [-Wdeprecated-declarations]
            json_object* poKeys = json_object_object_get(jsobj, "keys");
                                  ^
/usr/local/include/json-c/json_object.h:290:56: note: 'json_object_object_get' declared here
THIS_FUNCTION_IS_DEPRECATED(extern struct json_object* json_object_object_get(struct json_object* obj,
                                                       ^
/usr/local/include/json-c/json_object.h:17:43: note: expanded from macro 'THIS_FUNCTION_IS_DEPRECATED'
#define THIS_FUNCTION_IS_DEPRECATED(func) func __attribute__ ((deprecated))
                                          ^
2 warnings and 1 error generated.
gmake[4]: *** [../o/mbtilesdataset.o] Error 1
gmake[4]: Leaving directory `/usr/ports/graphics/gdal/work/gdal-1.11.0/frmts/mbtiles'
gmake[3]: *** [mbtiles-install-obj] Error 2
gmake[3]: Leaving directory `/usr/ports/graphics/gdal/work/gdal-1.11.0/frmts'
gmake[2]: *** [frmts-target] Error 2
gmake[2]: Leaving directory `/usr/ports/graphics/gdal/work/gdal-1.11.0'
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/graphics/gdal
*** Error code 1

Stop.
make: stopped in /usr/ports/graphics/gdal
Comment 4 John Marino freebsd_committer freebsd_triage 2014-08-19 22:48:55 UTC
Muhammad, this issue is caused by the removal of libjson.so

Can you investigate?
Comment 5 John Marino freebsd_committer freebsd_triage 2014-08-19 22:56:10 UTC
for fun I'll change the dependency in gdal to a different library and see if it still builds (which means the dependency wasn't specified correctly)
Comment 6 John Marino freebsd_committer freebsd_triage 2014-08-19 22:57:53 UTC
to clarify: that won't help gdal, it might help postgis21
Comment 7 John Marino freebsd_committer freebsd_triage 2014-08-19 23:04:17 UTC
Nope.  It started building but failed with this:

lwin_geojson.c:20:10: fatal error: 'json/json.h' file not found
Comment 8 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2014-08-20 04:30:25 UTC
I have fixed the problem. Can you guys afford some time? Then I can upgrade and convert it to OPTIONSNG too for postgis21.
Comment 9 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2014-08-20 06:09:24 UTC
Created attachment 146057 [details]
patch for postgis-2.1.3

- Update to 2.1.3
- Fix build with json-c-0.12
- Make proper use of OPTIONSNG
Comment 10 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2014-08-20 06:10:49 UTC
Poudriere log :
http://pdr.s.ubze.ro/bulk/latest-per-pkg/postgis/2.1.3/

I couldn't reproduce the problem for gdal. Please confirm.
Comment 11 John Marino freebsd_committer freebsd_triage 2014-08-20 06:13:09 UTC
okay, so the fix included updating postgis.  Let me do that now.
Comment 12 commit-hook freebsd_committer freebsd_triage 2014-08-20 06:24:15 UTC
A commit references this bug:

Author: marino
Date: Wed Aug 20 06:23:21 UTC 2014
New revision: 365432
URL: http://svnweb.freebsd.org/changeset/ports/365432

Log:
  databases/postgis21: Upgrade version 2.1.0 => 2.1.3

  This unbreaks the port after the json-c dependency update.
  While here, using modern options framework

  PR:		192840
  Submitted by;	Luca Corti
  Patch by:	Muhammad Rahman

Changes:
  head/databases/postgis21/Makefile
  head/databases/postgis21/distinfo
  head/databases/postgis21/files/
  head/databases/postgis21/files/patch-liblwgeom_lwin__geojson.c
  head/databases/postgis21/pkg-plist
Comment 13 John Marino freebsd_committer freebsd_triage 2014-08-20 06:41:29 UTC
Hi Trevor,
I took the liberty of committing that change to postgis because the port wasn't building anymore.  If you have any commits to it, you can add them to this PR.


Luca, I also can build gdal just fine.
Comment 14 John Marino freebsd_committer freebsd_triage 2014-08-20 23:47:55 UTC
closing on the assumption gdal issue is not reproducible on most systems, at least not in a clean environment like poudriere.
Comment 15 Luca Corti 2014-08-21 00:00:55 UTC
Can't really test this because GDAL is still broken for me, so I don't even get to the postgis compile step.
Comment 16 Luca Corti 2014-08-21 00:42:16 UTC
Ok, so here is what I found.

GDAL fails building if json-c 0.12 and/or libiconv is installed. If I remove both ports and rerun the GDAL build, it succeeds. So this prevents upgrading, not a fresh install.
Comment 17 Luca Corti 2014-08-21 00:58:58 UTC
Furthermore, postgis does build, but attempting to upgrade the PostgreSQL extension:

ALTER EXTENSION postgis UPDATE TO "2.1.3";
ERROR:  could not open extension control file "/usr/local/share/postgresql/extension/postgis.control": No such file or directory
Comment 18 Luca Corti 2014-08-21 01:22:27 UTC
Seems that file plus the SQL scripts are not copied to the postgresql extensions folder anymore.
Comment 19 Luca Corti 2014-08-21 01:42:41 UTC
For postgis_topology also.
Comment 20 John Marino freebsd_committer freebsd_triage 2014-08-21 05:57:09 UTC
I think you are getting a first-hand lesson why building on a live machine is a bad idea.  If you absolutely have to do it, I understand portmaster has the ability to recursively build the dependencies.

Personally I would set up poudriere, pick the ports that I need custom options, build those as a custom set, and use standard (official) FreeBSD packages for the rest.

This is a local issue.  That libiconv thing might be leftover from before it was almost eliminate in favor of the base iconv.
Comment 21 Luca Corti 2014-08-21 06:18:49 UTC
Ok, I understand that, but the ports are now building.

I may be mistaken but, the issue now is not libiconv or anything, the port is building, but the PostgreSQL extensions are not built.
Comment 22 John Marino freebsd_committer freebsd_triage 2014-08-21 08:26:49 UTC
(In reply to Luca Corti from comment #21)
> Ok, I understand that, but the ports are now building.
> 
> I may be mistaken but, the issue now is not libiconv or anything, the port
> is building, but the PostgreSQL extensions are not built.

what port does the postgres extension belong to?
Comment 23 Ilya Sysoev 2014-08-21 09:33:52 UTC
Should I open a new PR for missing extension control file ?
Without properly installed control file and SQL functions files this port is useless.
Comment 24 John Marino freebsd_committer freebsd_triage 2014-08-21 09:41:06 UTC
(In reply to Ilya Sysoev from comment #23)
> Should I open a new PR for missing extension control file ?
> Without properly installed control file and SQL functions files this port is
> useless.

I'll repeat the question:
what port does the postgres extension belong to?

The postgis21 pkg-plist hardly changed.
Comment 25 Ilya Sysoev 2014-08-21 12:58:01 UTC
Extensions belong to PostGIS port.

To get them you have to build PostGIS with Raster (GDAL) support.

From PostGIS Manual - http://download.osgeo.org/postgis/docs/postgis-2.1.3.pdf
GDAL (pseudo optional) only if you don’t want raster and don’t care about installing with CREATE EXTENSION POSTGIS can you leave it out. Keep in mind other extensions may have a requires postgis extension which will prevent you from installing them unless you install postgis as an extension. So it is highly recommended you compile with GDAL support.

I have a small compiling problem with strnicmp function in 
/usr/ports/databases/postgis21/work/postgis-2.1.3/raster/rt_core.c
Replaced it which strncasecmp and everything got fine.
Comment 26 John Marino freebsd_committer freebsd_triage 2014-08-21 13:00:23 UTC
Muhammad, can you try building postgis with GDAL option turned on in poudriere and see if you can then build gdal?
Comment 27 Robert Kruus 2014-08-21 15:20:11 UTC
The strnicmp bug in comment 25 is most likely due to a change in rt_api header file. Changing
#if defined(__FreeBSD_kernel__)...
to 
#if defined(__FreeBSD__)
allows successful compilation.  patAttached a patch for that.
Comment 28 Robert Kruus 2014-08-21 15:20:58 UTC
Created attachment 146115 [details]
Patch for raster header file.
Comment 29 Robert Kruus 2014-08-21 15:37:59 UTC
Looking back at the postgis tree, the made a in 2.1 to fix compiling on a Debian box.
http://trac.osgeo.org/postgis/ticket/2620
Comment 30 John Marino freebsd_committer freebsd_triage 2014-08-21 15:45:28 UTC
(In reply to Robert Kruus from comment #29)
> Looking back at the postgis tree, the made a in 2.1 to fix compiling on a
> Debian box.
> http://trac.osgeo.org/postgis/ticket/2620

Upstream made a mistake with that assumption.
It needs to be __FreeBSD__ or __FreeBSD_kernel__ not just the latter.

Maybe somebody there can commit on the bug report and open it up again?
Comment 31 commit-hook freebsd_committer freebsd_triage 2014-08-21 23:37:44 UTC
A commit references this bug:

Author: marino
Date: Thu Aug 21 23:37:09 UTC 2014
New revision: 365603
URL: http://svnweb.freebsd.org/changeset/ports/365603

Log:
  databases/postgis21: Restore build of non-default raster option

  Upstream made a change to support Debian's kFreeBSD and broke FreeBSD
  in the process.

  PR:		192840
  patch by:	Robert Kruus
  staging: 	marino

Changes:
  head/databases/postgis21/Makefile
  head/databases/postgis21/files/patch-raster_rt__core_rt__api.h
  head/databases/postgis21/pkg-plist
Comment 32 Po-Chuan Hsieh freebsd_committer freebsd_triage 2014-08-22 08:46:08 UTC
gdal fails to build with the change of json_tokener_errors [1] in json-c 0.12. It is fixed upstream [2] and committed as r365616.

[1] https://github.com/json-c/json-c/commit/f9136f68520db4761f05810f97922900ba459f46
[2] http://trac.osgeo.org/gdal/changeset/27267
Comment 33 John Marino freebsd_committer freebsd_triage 2014-08-22 10:18:12 UTC
(In reply to Sunpoet Po-Chuan Hsieh from comment #32)
> gdal fails to build with the change of json_tokener_errors [1] in json-c
> 0.12. It is fixed upstream [2] and committed as r365616.


Is it building with a specific option?  gdal continues to build just fine for me in poudriere.   I cannot reproduce the build failure.
Comment 34 John Marino freebsd_committer freebsd_triage 2014-08-22 19:43:38 UTC
(In reply to Sunpoet Po-Chuan Hsieh from comment #32)
> gdal fails to build with the change of json_tokener_errors [1] in json-c
> 0.12. It is fixed upstream [2] and committed as r365616.
> 

I'm closing PR based on this ^
I assume gdal is building now for everyone (it always was for me).