]> xenbits.xensource.com Git - libvirt.git/commit
util: avoid symbol clash between json libraries
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 31 Jul 2018 14:51:47 +0000 (15:51 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Tue, 31 Jul 2018 17:04:53 +0000 (18:04 +0100)
commitce3c6ef6843f98d81be5423ece11fad79eaab920
tree0dec0f0adb446990271d46db4ca067b5ff7ecee6
parent7bda210e6d1ff7fe95b5eaa20961b133990bfc19
util: avoid symbol clash between json libraries

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.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
libvirt.spec.in
src/Makefile.am
src/util/Makefile.inc.am
src/util/virjson.c
src/util/virjsoncompat.c [new file with mode: 0644]
src/util/virjsoncompat.h [new file with mode: 0644]