[postgis-tickets] [PostGIS] #2539: Check for json-c/json.h presence/usability before json/json.h
PostGIS
trac at osgeo.org
Thu May 15 10:08:10 PDT 2014
#2539: Check for json-c/json.h presence/usability before json/json.h
--------------------------+-------------------------------------------------
Reporter: mwtoews | Owner: pramsey
Type: enhancement | Status: reopened
Priority: medium | Milestone: PostGIS 2.1.2
Component: postgis | Version: 2.1.x
Resolution: | Keywords:
--------------------------+-------------------------------------------------
Changes (by kzalewski):
* status: closed => reopened
* resolution: fixed =>
Comment:
Although detection of json-c/json.h is now working during the configure
stage, compilation of PostGIS 2.1.2 still fails when using json-c 0.12.
The file liblwgeom/lwin_geojson.c contains the following headers:
{{{
#include <json/json.h>
#include <json/json_object_private.h>
}}}
which yields this compilation error:
{{{
libtool: compile: gcc -O2 -fPIC -fPIC -DPIC -Wall -Wmissing-prototypes
-I/usr/include -c lwin_geojson.c -fPIC -DPIC -o .libs/lwin_geojson.o
lwin_geojson.c:20:23: fatal error: json/json.h: No such file or directory
compilation terminated.
}}}
In addition, once the #include lines are changed to <json-c/json.h> and
<json-c/json_object_private.h>, there is an additional compilation error:
{{{
libtool: compile: gcc -O2 -fPIC -fPIC -DPIC -Wall -Wmissing-prototypes
-I/usr/include -c lwin_geojson.c -fPIC -DPIC -o .libs/lwin_geojson.o
lwin_geojson.c: In function 'parse_geojson_coord':
lwin_geojson.c:71:6: warning: unused variable 'iType' [-Wunused-variable]
lwin_geojson.c: In function 'lwgeom_from_geojson':
lwin_geojson.c:515:43: error: 'json_tokener_errors' undeclared (first use
in this function)
lwin_geojson.c:515:43: note: each undeclared identifier is reported only
once for each function it appears in
}}}
The json_tokener_errors[] array has been replaced in json-c 0.12 with a
function json_tokener_error_desc(). So a simple edit needs to be made to
change:
{{{
json_tokener_errors[jstok->error]
}}}
to:
{{{
json_tokener_error_desc(jstok->error)
}}}
Making this simple change from the deprecated array to the new function
allows compilation to proceed to completion.
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2539#comment:3>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list