#6440 closed defect (fixed)
gdalinfo fails to build with external json-c
Reported by: | Bas Couwenberg | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 2.0.3 |
Component: | default | Version: | 2.0.2 |
Severity: | normal | Keywords: | |
Cc: |
Description (last modified by )
Triggered by #6438 I switched the GDAL Debian package build to use the external libjson-c with ./configure --with-libjson-c=/usr
and this caused a build failure:
/bin/bash /build/gdal-2.0.2+dfsg/libtool --mode=compile --tag=CC gcc -I/build/gdal-2.0.2+dfsg/port -I/build/gdal-2.0.2+dfsg/gcore -I/build/gdal-2.0.2+dfsg/alg -I/build/gdal-2.0.2+dfsg/ogr -I/build/gdal-2.0.2+dfsg/ogr/ogrsf_frmts -g -O2 -fstack-protector-strong -Wformat -fvisibility=hidden -Wall -Wdeclaration-after-statement -I/build/gdal-2.0.2+dfsg/frmts/vrt -DOGR_ENABLED -Wdate-time -D_FORTIFY_SOURCE=2 -I/build/gdal-2.0.2+dfsg/port -I/usr/include -I/usr/include -DGDAL_COMPILATION -I/usr/include/json-c -I/build/gdal-2.0.2+dfsg/ogr/ogrsf_frmts/geojson -DHAVE_GEOS=1 -I/usr/include -c -o gdalinfo.lo gdalinfo.c libtool: compile: gcc -I/build/gdal-2.0.2+dfsg/port -I/build/gdal-2.0.2+dfsg/gcore -I/build/gdal-2.0.2+dfsg/alg -I/build/gdal-2.0.2+dfsg/ogr -I/build/gdal-2.0.2+dfsg/ogr/ogrsf_frmts -g -O2 -fstack-protector-strong -Wformat -fvisibility=hidden -Wall -Wdeclaration-after-statement -I/build/gdal-2.0.2+dfsg/frmts/vrt -DOGR_ENABLED -Wdate-time -D_FORTIFY_SOURCE=2 -I/build/gdal-2.0.2+dfsg/port -I/usr/include -I/usr/include -DGDAL_COMPILATION -I/usr/include/json-c -I/build/gdal-2.0.2+dfsg/ogr/ogrsf_frmts/geojson -DHAVE_GEOS=1 -I/usr/include -c gdalinfo.c -fPIC -DPIC -o .libs/gdalinfo.o libtool: compile: gcc -I/build/gdal-2.0.2+dfsg/port -I/build/gdal-2.0.2+dfsg/gcore -I/build/gdal-2.0.2+dfsg/alg -I/build/gdal-2.0.2+dfsg/ogr -I/build/gdal-2.0.2+dfsg/ogr/ogrsf_frmts -g -O2 -fstack-protector-strong -Wformat -fvisibility=hidden -Wall -Wdeclaration-after-statement -I/build/gdal-2.0.2+dfsg/frmts/vrt -DOGR_ENABLED -Wdate-time -D_FORTIFY_SOURCE=2 -I/build/gdal-2.0.2+dfsg/port -I/usr/include -I/usr/include -DGDAL_COMPILATION -I/usr/include/json-c -I/build/gdal-2.0.2+dfsg/ogr/ogrsf_frmts/geojson -DHAVE_GEOS=1 -I/usr/include -c gdalinfo.c -o gdalinfo.o >/dev/null 2>&1 /bin/bash /build/gdal-2.0.2+dfsg/libtool --mode=compile --tag=CXX g++ -I/build/gdal-2.0.2+dfsg/port -I/build/gdal-2.0.2+dfsg/gcore -I/build/gdal-2.0.2+dfsg/alg -I/build/gdal-2.0.2+dfsg/ogr -I/build/gdal-2.0.2+dfsg/ogr/ogrsf_frmts -g -O2 -fstack-protector-strong -Wformat -fvisibility=hidden -Wall -I/build/gdal-2.0.2+dfsg/frmts/vrt -DOGR_ENABLED -Wdate-time -D_FORTIFY_SOURCE=2 -I/build/gdal-2.0.2+dfsg/port -I/usr/include -I/usr/include -DGDAL_COMPILATION -I/usr/include/json-c -I/build/gdal-2.0.2+dfsg/ogr/ogrsf_frmts/geojson -DHAVE_GEOS=1 -I/usr/include -c -o commonutils.lo commonutils.cpp libtool: compile: g++ -I/build/gdal-2.0.2+dfsg/port -I/build/gdal-2.0.2+dfsg/gcore -I/build/gdal-2.0.2+dfsg/alg -I/build/gdal-2.0.2+dfsg/ogr -I/build/gdal-2.0.2+dfsg/ogr/ogrsf_frmts -g -O2 -fstack-protector-strong -Wformat -fvisibility=hidden -Wall -I/build/gdal-2.0.2+dfsg/frmts/vrt -DOGR_ENABLED -Wdate-time -D_FORTIFY_SOURCE=2 -I/build/gdal-2.0.2+dfsg/port -I/usr/include -I/usr/include -DGDAL_COMPILATION -I/usr/include/json-c -I/build/gdal-2.0.2+dfsg/ogr/ogrsf_frmts/geojson -DHAVE_GEOS=1 -I/usr/include -c commonutils.cpp -fPIC -DPIC -o .libs/commonutils.o libtool: compile: g++ -I/build/gdal-2.0.2+dfsg/port -I/build/gdal-2.0.2+dfsg/gcore -I/build/gdal-2.0.2+dfsg/alg -I/build/gdal-2.0.2+dfsg/ogr -I/build/gdal-2.0.2+dfsg/ogr/ogrsf_frmts -g -O2 -fstack-protector-strong -Wformat -fvisibility=hidden -Wall -I/build/gdal-2.0.2+dfsg/frmts/vrt -DOGR_ENABLED -Wdate-time -D_FORTIFY_SOURCE=2 -I/build/gdal-2.0.2+dfsg/port -I/usr/include -I/usr/include -DGDAL_COMPILATION -I/usr/include/json-c -I/build/gdal-2.0.2+dfsg/ogr/ogrsf_frmts/geojson -DHAVE_GEOS=1 -I/usr/include -c commonutils.cpp -o commonutils.o >/dev/null 2>&1 /bin/bash /build/gdal-2.0.2+dfsg/libtool --mode=link g++ -Wl,-z,relro -Wl,-z,now gdalinfo.lo commonutils.lo /build/gdal-2.0.2+dfsg/libgdal.la -o gdalinfo libtool: link: g++ -Wl,-z -Wl,relro -Wl,-z -Wl,now .libs/gdalinfo.o .libs/commonutils.o -o .libs/gdalinfo /build/gdal-2.0.2+dfsg/.libs/libgdal.so -pthread /usr/bin/ld: .libs/gdalinfo.o: undefined reference to symbol 'json_object_new_int' //lib/x86_64-linux-gnu/libjson-c.so.2: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status
The attached patch adds -ljson-c
to the link flags when external libjson-c is used.
Attachments (1)
Change History (4)
by , 8 years ago
Attachment: | libjson-c.patch added |
---|
comment:1 by , 8 years ago
Description: | modified (diff) |
---|
comment:2 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 8 years ago
Thanks, I've replaced my patch with the changes from r33882 in the Debian package. It's included in gdal (2.0.2+dfsg-5) uploaded to Debian unstable today.
I can confirm that 2.1.0beta1 doesn't need the changes, it builds successfully with external json-c without further changes.
Note:
See TracTickets
for help on using tickets.
I tried to reproduce locally on my Ubuntu 14.04.4 LTS, but didn't get any link error. Perhaps due to different libtool versions
See
Anyway, I applied branches/2.0 r33882 "When using external libjson, explictly link GDAL utilities (particularly gdalinfo that directly uses libjson) against it (derived from patch by Sebastian Couwenberg, #6440)" . The complement w.r.t your proposed patch is to be able to handle external libjson in non system location.
I don't think this is needed in trunk since code from gdalinfo has been migrated into libgdal itself.