[libvirt] [PATCH 0/3] Fix examples/ under mingw

Daniel P. Berrangé berrange at redhat.com
Wed Jan 9 12:53:06 UTC 2019


On Wed, Jan 09, 2019 at 01:33:44PM +0100, Andrea Bolognani wrote:
> On Tue, 2019-01-08 at 13:56 -0600, Eric Blake wrote:
> > My recent patch to make all of the examples work independently of
> > gnulib worked fine on Linux, but failed on mingw:
> > https://travis-ci.org/libvirt/libvirt/jobs/476898635
> > 
> > The whole point of gnulib is to work around portability pitfalls so
> > we don't have to bend over backwards thinking about it in our code;
> > and it would be possible to fix this bug by linking the problematic
> > example binaries against gnulib after all.  But since the examples
> > are still small and self-contained enough that using manual
> > workarounds wasn't too daunting, that's the approach I took here.
> 
> It's kind of a done deal now, but I still wonder if it was the right
> approach.
> 
> The way I see it, our examples are supposed to illustrate how to use
> libvirt itself, not how to write C code that is portable to a
> multitude of platforms: with that goal in mind, taking advantage of
> gnulib makes perfect sense, as it allows us to put the focus on the
> usage of libvirt rather than the surrounding compatibility gunk.

Using gnulib is not an easy thing if you are not familiar with
it, largely because of the painful autotools integration it
imposes. It is important that the examples are both simple to
read, and simple to build standalone. We've always considered that
the examples should be possible to build using nothing more than
the C compiler and pkg-config. eg 

  $CC  `pkg-config --cflags --libs libvirt` -o foo foo.c

The benefits of gnulib are not compelling enough to be worth the
complexity that it brings in for the examples. 

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