[gdal-dev] undefined reference to `json_object_new_array linking with libgdal.a
Even Rouault
even.rouault at spatialys.com
Wed Jul 22 09:16:09 PDT 2020
On mercredi 22 juillet 2020 08:46:56 CEST Luís Moreira de Sousa wrote:
> Hi Even, thank you for the reply.
>
> libjson-c-dev is already installed in the system, and the linker can find
> it:
>
> $ ld -ljson-c --verbose
> [...]
> ==================================================
> ld: mode elf_x86_64
> attempt to open /usr/local/lib/x86_64-linux-gnu/libjson-c.so failed
> attempt to open /usr/local/lib/x86_64-linux-gnu/libjson-c.a failed
> attempt to open /lib/x86_64-linux-gnu/libjson-c.so failed
> attempt to open /lib/x86_64-linux-gnu/libjson-c.a failed
> attempt to open /usr/lib/x86_64-linux-gnu/libjson-c.so succeeded
> /usr/lib/x86_64-linux-gnu/libjson-c.so
> [...]
>
> But the compiler still fails in the same way, whether I include the -json-c
> flag or not. Below is the output with the full compiler command:
>
> g++ -I../../lib/dglib/include -I../../lib/shapelib/include
> -I../../lib/proj4lib/include -I/usr/include/gdal -O3 -std=c++11 -ljson-c -o
> dggrid binvals.o dggrid.o quadclip.o transform.o binpres.o gridgen.o
> DgHexSF.o param.o clipper.o table.o util.o ../../lib/dglib/lib/dglib.a
> ../../lib/shapelib/lib/shapelib.a ../../lib/proj4lib/lib/proj4lib.a
> /usr/lib/libgdal.a /usr/bin/ld: /usr/lib/libgdal.a(shp_vsi.o): in function
> `SASetupDefaultHooks': (.text+0x2d0): multiple definition of
> `SASetupDefaultHooks';
Ah sorry I read your initial message too fast. I thought you had an issue building GDAL itself.
The SASetupDefaultHooks issue might come from it being defined in shapelib.a and in GDAL
too.
Did you build GDAL with --with-hide-internal-symbols ?
Any reason to use static linking ? This is generally an extra pain
--
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200722/15cb9cce/attachment.html>
More information about the gdal-dev
mailing list