[gdal-dev] undefined reference to `json_object_new_array linking with libgdal.a

Luí­s Moreira de Sousa luis.de.sousa at protonmail.ch
Tue Jul 21 11:02:09 PDT 2020


Dear all,

I am trying to compile a programme on Ubuntu 20.04 that links with libgdal.a. The compiler fails with this message:

/usr/bin/ld: /usr/lib/libgdal.a(ogrfeature.o): in function `OGRFeature::GetFieldAsSerializedJSon(int) const':
(.text+0x3861): undefined reference to `json_object_new_array'

If I understand it correctly, this means the json library is not being found. I thus made sure ld can actually find it:

$ ld -ljson --verbose
[...]
==================================================
ld: mode elf_x86_64
attempt to open /usr/local/lib/x86_64-linux-gnu/libjson.so failed
attempt to open /usr/local/lib/x86_64-linux-gnu/libjson.a failed
attempt to open /lib/x86_64-linux-gnu/libjson.so succeeded
/lib/x86_64-linux-gnu/libjson.so
[...]

I also added the -ljson flag but the compiler still fails. Is there something else missing beyond the json library?

Thank you.
--
Luís

Sent with [ProtonMail](https://protonmail.com) Secure Email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200721/f29a738b/attachment.html>


More information about the gdal-dev mailing list