bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mingw pollution of DATADIR vs. configmake.h [was: [libvirt] [PATCH v


From: Eric Blake
Subject: Re: mingw pollution of DATADIR vs. configmake.h [was: [libvirt] [PATCH v10 08/19] backup: Parse and output checkpoint XML]
Date: Mon, 29 Jul 2019 12:18:12 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0

[dropping libvirt list for now...]

On 7/29/19 11:25 AM, Eric Blake wrote:
> [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:
> 

> 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.

Why does including <unistd.h> first for libvirt work? Because
unistd.in.h has:

/* Get all possible declarations of gethostname().  */
#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
  && !defined _GL_INCLUDING_WINSOCK2_H
# define _GL_INCLUDING_WINSOCK2_H
# include <winsock2.h>
# undef _GL_INCLUDING_WINSOCK2_H
#endif

and libvirt is using the gethostname module. But the namespace collision
problem is present whether or not the gethostname module is in use - it
is any mix-and-match of <winsock2.h> with "configmake.h".  So I'm not
immediately sure what the best gnulib patch should be (making the
configmake module depend on the unistd module seems like it is
insufficient if there are other ways that winsock2.h can be in use).

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]