Opened 10 years ago
Closed 10 years ago
#2783 closed defect (fixed)
Getting compile error when compiling json with custom json-dir
Reported by: | robe | Owned by: | pramsey |
---|---|---|---|
Priority: | blocker | Milestone: | PostGIS 2.2.0 |
Component: | postgis | Version: | master |
Keywords: | Cc: |
Description
I forget if this was after strk's change or pramsey's change.
Winnie is exhibiting this error:
configure part for json looks like
Using user-specified proj directory: /projects/proj/rel-4.8.0w32gcc48 checking proj_api.h usability... yes checking proj_api.h presence... yes checking for proj_api.h... yes checking for pj_get_release in -lproj... yes Using user-specified json-c directory: /projects/json-c/rel-0.10w32gcc48 checking json/json.h usability... yes checking json/json.h presence... yes checking for json/json.h... yes checking for json_object_get in -ljson-c... no checking for json_object_get in -ljson... yes
lwgeom_in_geojson.c:24:25: fatal error: json/json.h: No such file or directory # include <json/json.h> ^ compilation terminated. <builtin>: recipe for target `lwgeom_in_geojson.o' failed
Change History (10)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Okay i compared the configure.ac scripts, and that is not what changed between 2.1 and 2.2. Only difference between them is the a line got commented out.
In 2.1 it's
AC_MSG_RESULT([CPPFLAGS: $CPPFLAGS])
In 2.2 it's
dnl AC_MSG_RESULT([CPPFLAGS: $CPPFLAGS])
Not sure why someone did that as I would think seeing that variable would be useful
I did find the smoking gun — it's exactly where the error says.
These lines were added in 2.2:
#ifdef HAVE_LIBJSON # ifdef HAVE_LIBJSON_C # include <json-c/json.h> # else # include <json/json.h> # endif #endif
If I remove them my code compiles again. I'm still puzzled why my json 0.9 works with these lines and my 0.10 doesn't. Unless if its something to do with the fact that it is static vs. 0.10 being dynamic.
why did we add these line here? they don't seem to be needed as far as I can tell.
comment:3 by , 10 years ago
As strk noted we need that include to get the version number. I was able to get things to compile by changing:
line 901 of configure.ac from
CPPFLAGS="$PGSQL_CPPFLAGS $GEOS_CPPFLAGS $PROJ_CPPFLAGS $XML2_CPPFLAGS $SFCGAL_CPPFLAGS $CPPFLAGS"
to
CPPFLAGS="$PGSQL_CPPFLAGS $GEOS_CPPFLAGS $PROJ_CPPFLAGS $XML2_CPPFLAGS $SFCGAL_CPPFLAGS $JSON_CPPFLAGS $CPPFLAGS"
still regress checking and if all are in agreement I'll go ahead and commit for 2.0-2.2
comment:5 by , 10 years ago
Summary: | Getting compile error when compiling against json 0.10 in mingw64 → Getting compile error when compiling json with custom json-dir |
---|
committed to trunk (2.2) at r12688 also changed title of this since I don't think its a mingw64 issue and more has to do with custom json-dir.
I'm also thinking of not committing this to 2.1 or 2.0. Those ones don't have the version check so techinically they don't need this patch.
comment:6 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Decided not to commit to 2.1 and 2.0 don't fix what isn't broken.
comment:7 by , 10 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:8 by , 10 years ago
Oh boy fix one thing break another, now winnie's json 0.9 (PostgreSQL 9.1) is no longer happy. I was planning to upgrade it anyway but it's kinda annoying it works for one and not the other.
lwgeom_in_geojson.c:1:0: warning: -fPIC ignored for target (all code is position independent) In file included from e:/jenkins/json-c/rel-0.9w64/include/json/json_util.h:15:0, from e:/jenkins/json-c/rel-0.9w64/include/json/json.h:23, from lwgeom_in_geojson.c:24: e:/jenkins/json-c/rel-0.9w64/include/json/json_object.h:32:13: error: conflicting types for 'boolean' c:\ming64\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.4/../../../../x86_64-w64-mingw32/include/rpcndr.h:52:25: note: previous declaration of 'boolean' was here make[1]: *** [lwgeom_in_geojson.o] Error 1 make[1]: Leaving directory `/projects/postgis/branches/2.2/postgis' make: *** [all] Error 1
I think I got this error earlier on with 0.9 and just started compiling with -w option or something. Have to look at my notes.
comment:9 by , 10 years ago
oh yippie deja vu and I learned down my excursion of history lane that strk originally took out the json from configure.ac and moved it to lwgeom
http://trac.osgeo.org/postgis/ticket/2218
since this is likely only a windows version, I'm tempted to just upgrade the ones I have that use json 0.9 to newer (which I was goong to do anyway). As long as we don't port back these changes to 2.1 nd 2.0 which we shouldn't need to do since we are not reading version numbers in those. And if we do I guess I can just upgrade to newer json chain on those.
comment:10 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
I'm not going to bother with 0.9 anymore for 2.2. Just upgraded 2.2 to use static compiled json 0.12. Since this 0.9 issue is probably a mingw only issue, probably not worth fixing when newer json works fine.
Okay I think the include path is somehow getting lost. The line before the above error is:
note how there is absense of json-c include (maybe the JSON-CPP flags or something is wrong).
However if I look at the libtool lines, they do have the include and lib paths: