The recent update to gnulib
commit 9d7a37ecb2ab516c19164a57b8aeb32016a99d2c
Author: Eric Blake <eblake(a)redhat.com>
Date: Thu Sep 15 15:12:52 2016 -0500
build: update to latest gnulib
Pulled in a change that adds -fno-common to the default compiler
flags
commit bf8e658ffadb95d444f56d222d04c9af955af765
Author: Jim Meyering <meyering(a)fb.com>
Date: Fri Sep 2 09:16:16 2016 -0700
manywarnings: add -fno-common
This caused libvirt Mingw build to break with the compiler
reporting 100's of definitions of virConnectAuthPtrDefault
./.libs/libvirt_util.a(libvirt_util_la-virarch.o):virarch.c:(.bss+0x0): multiple
definition of `virConnectAuthPtrDefault'
./.libs/libvirt_util.a(libvirt_util_la-viralloc.o):viralloc.c:(.bss+0x0): first defined
here
./.libs/libvirt_util.a(libvirt_util_la-viratomic.o):viratomic.c:(.bss+0x0): multiple
definition of `virConnectAuthPtrDefault'
./.libs/libvirt_util.a(libvirt_util_la-viralloc.o):/home/berrange/src/virt/libvirt/src/util/viralloc.c:87:
first defined here
./.libs/libvirt_util.a(libvirt_util_la-viraudit.o):viraudit.c:(.bss+0x0): multiple
definition of `virConnectAuthPtrDefault'
./.libs/libvirt_util.a(libvirt_util_la-viralloc.o):/home/berrange/src/virt/libvirt/src/util/viralloc.c:87:
first defined here
./.libs/libvirt_util.a(libvirt_util_la-virauth.o):virauth.c:(.bss+0x0): multiple
definition of `virConnectAuthPtrDefault'
./.libs/libvirt_util.a(libvirt_util_la-viralloc.o):/home/berrange/src/virt/libvirt/src/util/viralloc.c:87:
first defined here
./.libs/libvirt_util.a(libvirt_util_la-virauthconfig.o):virauthconfig.c:(.bss+0x0):
multiple definition of `virConnectAuthPtrDefault'
...snip...
The cause is our VIR_EXPORT_VAR macro which has some
magic on win to add dllexport/dllimport to the variable
declaration. Unfortunately the dllexport branch missed
off the 'extern' keyword, so the header file was in
fact declaring an instance of the variable in every
source file.
Previously the linker would merge all these definitions
into one, but that no longer happens due to -fno-common
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
Pushing as a CI build fix
include/libvirt/libvirt-common.h.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/libvirt/libvirt-common.h.in b/include/libvirt/libvirt-common.h.in
index 79bfe90..0e8ada4 100644
--- a/include/libvirt/libvirt-common.h.in
+++ b/include/libvirt/libvirt-common.h.in
@@ -49,7 +49,7 @@ extern "C" {
# define VIR_EXPORT_VAR extern
# else
# ifdef IN_LIBVIRT
-# define VIR_EXPORT_VAR __declspec(dllexport)
+# define VIR_EXPORT_VAR __declspec(dllexport) extern
# else
# define VIR_EXPORT_VAR __declspec(dllimport) extern
# endif
--
2.7.4