Opened 8 years ago

Last modified 8 years ago

#6440 closed defect

gdalinfo fails to build with external json-c — at Version 1

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 Bas Couwenberg)

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.

Change History (2)

by Bas Couwenberg, 8 years ago

Attachment: libjson-c.patch added

comment:1 by Bas Couwenberg, 8 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.