On Tue, Jul 31, 2018 at 05:27:36PM +0100, Daniel P. Berrangé wrote:
The jansson and json-glib libraries both export symbols with a json_
name prefix and json_object_iter_next() clashes between them.
Unfortunately json_glib is linked in by GTK, so any app using GTK and
libvirt will get a clash, resulting in SEGV. This also affects the NSS
module provided by libvirt
Instead of directly linking to jansson, use dlopen() with the RTLD_LOCAL
flag which allows us to hide the symbols from the application that loads
libvirt or the NSS module.
Some preprocessor black magic and wrapper functions are used to redirect
calls into the dlopen resolved symbols.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
libvirt.spec.in | 2 +
src/Makefile.am | 5 +-
src/util/Makefile.inc.am | 3 +-
src/util/virjson.c | 9 +-
src/util/virjsoncompat.c | 274 +++++++++++++++++++++++++++++++++++++++
src/util/virjsoncompat.h | 88 +++++++++++++
6 files changed, 377 insertions(+), 4 deletions(-)
create mode 100644 src/util/virjsoncompat.c
create mode 100644 src/util/virjsoncompat.h
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
(Compiles without jansson-devel and on Debian 8 too)
Jano