[libvirt] [PATCH] util: avoid symbol clash between json libraries

Daniel P. Berrangé berrange at redhat.com
Tue Jul 31 16:29:54 UTC 2018


On Tue, Jul 31, 2018 at 06:07:20PM +0200, Ján Tomko wrote:
> On Tue, Jul 31, 2018 at 03:55:28PM +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
> 
> json-glib

Not fixed in v2, but fixed in my local copy now.

> > +#include <config.h>
> > +
> > +#include "virthread.h"
> > +#include "virerror.h"
> 
> > +#define VIR_JSON_COMPAT_IMPL
> > +#include "virjsoncompat.h"
> 
> virjsoncompat.h includes jansson.h unconditionally, so this fails to
> compile on a machine without jansson-devel:
> In file included from util/virjsoncompat.c:27:
> util/virjsoncompat.h:56:10: fatal error: jansson.h: No such file or directory
> #include <jansson.h>
>          ^~~~~~~~~~~

I've rearranged things and tested a mingw build now so this should
be ok in v2.

> > +#define LOAD(name) \
> > +    do { \
> > +        if (!(name ## _ptr = dlsym(handle, #name))) {                  \
> > +            virReportError(VIR_ERR_NO_SUPPORT,                          \
> > +                           _("missing symbol '%s' in libjansson.so.4: %s"), #name, dlerror()); \
> > +            goto error;                                                 \
> 
> If you do
>  return -1;
> you can drop the error label.

Yes ok




Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list