[libvirt] [PATCH] log_manager: Include configmake.h last

The problem is that in some mingw header DATADIR is used but gnulib defines it too. This leads to the following compile error: CC locking/libvirt_driver_la-lock_manager.lo In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/objbase.h:66:0, 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 ../../src/util/virutil.h:29, from ../../src/logging/log_manager.c:30: /usr/i686-w64-mingw32/sys-root/mingw/include/objidl.h:12275:2: error: expected identifier or '(' before string constant } DATADIR; ^ Makefile:7888: recipe for target 'logging/libvirt_driver_la-log_manager.lo' failed The fix is to include configmake.h at the end of includes. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/logging/log_manager.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/logging/log_manager.c b/src/logging/log_manager.c index 5ff5f12..7a4c7e2 100644 --- a/src/logging/log_manager.c +++ b/src/logging/log_manager.c @@ -22,8 +22,6 @@ #include <config.h> -#include "configmake.h" - #include "log_manager.h" #include "log_protocol.h" #include "viralloc.h" @@ -33,6 +31,7 @@ #include "virfile.h" #include "rpc/virnetclient.h" +#include "configmake.h" #define VIR_FROM_THIS VIR_FROM_LOGGING -- 2.4.10

On Tue, Dec 01, 2015 at 05:08:53PM +0100, Michal Privoznik wrote:
The problem is that in some mingw header DATADIR is used but gnulib defines it too. This leads to the following compile error:
CC locking/libvirt_driver_la-lock_manager.lo In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/objbase.h:66:0, 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 ../../src/util/virutil.h:29, from ../../src/logging/log_manager.c:30: /usr/i686-w64-mingw32/sys-root/mingw/include/objidl.h:12275:2: error: expected identifier or '(' before string constant } DATADIR; ^ Makefile:7888: recipe for target 'logging/libvirt_driver_la-log_manager.lo' failed
The fix is to include configmake.h at the end of includes.
Same issue that I was fixing with commit 976abdf66975, I see. I wonder if there's anything we could do to fix this for good, but that's a thought for another day. ACK
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/logging/log_manager.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/logging/log_manager.c b/src/logging/log_manager.c index 5ff5f12..7a4c7e2 100644 --- a/src/logging/log_manager.c +++ b/src/logging/log_manager.c @@ -22,8 +22,6 @@
#include <config.h>
-#include "configmake.h" - #include "log_manager.h" #include "log_protocol.h" #include "viralloc.h" @@ -33,6 +31,7 @@ #include "virfile.h"
#include "rpc/virnetclient.h" +#include "configmake.h"
#define VIR_FROM_THIS VIR_FROM_LOGGING
-- 2.4.10
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

[adding bug-gnulib] On 12/01/2015 10:03 AM, Martin Kletzander wrote:
On Tue, Dec 01, 2015 at 05:08:53PM +0100, Michal Privoznik wrote:
The problem is that in some mingw header DATADIR is used but gnulib defines it too. This leads to the following compile error:
CC locking/libvirt_driver_la-lock_manager.lo In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/objbase.h:66:0, 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 ../../src/util/virutil.h:29, from ../../src/logging/log_manager.c:30: /usr/i686-w64-mingw32/sys-root/mingw/include/objidl.h:12275:2: error: expected identifier or '(' before string constant } DATADIR; ^ Makefile:7888: recipe for target 'logging/libvirt_driver_la-log_manager.lo' failed
The fix is to include configmake.h at the end of includes.
Same issue that I was fixing with commit 976abdf66975, I see. I wonder if there's anything we could do to fix this for good, but that's a thought for another day.
I wonder if gnulib should fix configmake.h to first include <winsock2.h> when that header exists. It will pollute the namespace more heavily, but would at least make configmake.h always work when included first, and make compile errors due to windows namespace pollution easier to find reliably and not just because a project randomly changes its own include ordering. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Eric Blake
-
Martin Kletzander
-
Michal Privoznik