bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: libvir-list@redhat.com
Cc: Michal Privoznik <mprivozn@redhat.com>,
	pkrempa@redhat.com, Gnulib bugs <bug-gnulib@gnu.org>
Subject: mingw pollution of DATADIR vs. configmake.h [was: [libvirt] [PATCH v10 08/19] backup: Parse and output checkpoint XML]
Date: Mon, 29 Jul 2019 11:25:37 -0500	[thread overview]
Message-ID: <6e20ccab-6507-e2ed-bd06-98f7d6112e50@redhat.com> (raw)
In-Reply-To: <20190724055609.30691-9-eblake@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 2835 bytes --]

[adding bug-gnulib]

On 7/24/19 12:55 AM, Eric Blake wrote:
> Add a new file checkpoint_conf.c that performs the translation to and
> from new XML describing a checkpoint. The code shares a common base
> class with snapshots, since a checkpoint similarly represents the
> domain state at a moment in time. Add some basic testing of round trip
> XML handling through the new code.

> +++ b/src/conf/checkpoint_conf.c

> +#include <config.h>
> +
> +#include "configmake.h"
> +#include "internal.h"
> +#include "virbitmap.h"
> +#include "virbuffer.h"
> +#include "datatypes.h"

This causes a compilation failure on mingw, due to libvirt's
"datatypes.h" including <winsock.h> after the point at which gnulib's
"configmake.h" has already #define'd DATADIR into a string, but mingw's
winsock.h tries to use DATADIR as a data-type tag name:

make  all-am
make[1]: Entering directory '/home/berrange/src/virt/libvirt/src'
  CC       conf/libvirt_conf_la-checkpoint_conf.lo
In file included from
/usr/i686-w64-mingw32/sys-root/mingw/include/objbase.h:66,
                 from
/usr/i686-w64-mingw32/sys-root/mingw/include/ole2.h:17,
                 from
/usr/i686-w64-mingw32/sys-root/mingw/include/wtypes.h:12,
                 from
/usr/i686-w64-mingw32/sys-root/mingw/include/winscard.h:10,
                 from
/usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:97,
                 from
/usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:23,
                 from ../gnulib/lib/unistd.h:48,
                 from ./driver.h:24,
                 from ./datatypes.h:26,
                 from conf/checkpoint_conf.c:28:
/usr/i686-w64-mingw32/sys-root/mingw/include/objidl.h:12275:2: error:
expected identifier or '(' before string constant
 } DATADIR;
  ^~~~~~~~~
make[1]: *** [Makefile:10127: conf/libvirt_conf_la-checkpoint_conf.lo]
Error 1



And it's not the first time libvirt has run into this issue; I've found
the following commits in 2015 that worked around it:
https://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=976abdf6
https://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=bd205a90

Gnulib should work around this: perhaps "configmake.h" should include
<unistd.h> first when built on mingw, as that is sufficient to trigger
enough other headers to be included such that a later inclusion of
<winsock.h> after "configmake.h" no longer runs into an issue with the
DATADIR pollution breaking compilation, or perhaps gnulib can wrap
<winsock.h> in such a way that it no longer depends on a tag name
DATADIR.  In the meantime, I'll push an obvious fix to libvirt to
reorder the header inclusions to work around the problem.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

       reply	other threads:[~2019-07-29 16:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190724055609.30691-1-eblake@redhat.com>
     [not found] ` <20190724055609.30691-9-eblake@redhat.com>
2019-07-29 16:25   ` Eric Blake [this message]
2019-07-29 17:18     ` mingw pollution of DATADIR vs. configmake.h [was: [libvirt] [PATCH v10 08/19] backup: Parse and output checkpoint XML] Eric Blake
2019-07-29 22:29       ` Bruno Haible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6e20ccab-6507-e2ed-bd06-98f7d6112e50@redhat.com \
    --to=eblake@redhat.com \
    --cc=bug-gnulib@gnu.org \
    --cc=libvir-list@redhat.com \
    --cc=mprivozn@redhat.com \
    --cc=pkrempa@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).