|
|
c401cc |
From 4f1ad3619ec3ec8614bc34ff78d4f4be45921b43 Mon Sep 17 00:00:00 2001
|
|
|
c401cc |
Message-Id: <4f1ad3619ec3ec8614bc34ff78d4f4be45921b43.1390394207.git.jdenemar@redhat.com>
|
|
|
c401cc |
From: Eric Blake <eblake@redhat.com>
|
|
|
c401cc |
Date: Mon, 20 Jan 2014 09:03:24 -0700
|
|
|
c401cc |
Subject: [PATCH] build: more workarounds for if_bridge.h
|
|
|
c401cc |
|
|
|
c401cc |
https://bugzilla.redhat.com/show_bug.cgi?id=1042937
|
|
|
c401cc |
|
|
|
c401cc |
This is a second attempt at fixing the problem first attempted
|
|
|
c401cc |
in commit 2df8d99; basically undoing the fact that it was
|
|
|
c401cc |
reverted in commit 43cee32f, plus fixing two more issues: the
|
|
|
c401cc |
code in configure.ac has to EXACTLY match virnetdevbridge.c
|
|
|
c401cc |
with regards to declaring in6 types before using if_bridge.h,
|
|
|
c401cc |
and the fact that RHEL 5 has even more conflicts:
|
|
|
c401cc |
|
|
|
c401cc |
In file included from util/virnetdevbridge.c:49:
|
|
|
c401cc |
/usr/include/linux/in6.h:47: error: conflicting types for 'in6addr_any'
|
|
|
c401cc |
/usr/include/netinet/in.h:206: error: previous declaration of 'in6addr_any' was here
|
|
|
c401cc |
/usr/include/linux/in6.h:49: error: conflicting types for 'in6addr_loopback'
|
|
|
c401cc |
/usr/include/netinet/in.h:207: error: previous declaration of 'in6addr_loopback' was here
|
|
|
c401cc |
|
|
|
c401cc |
The rest of this commit message borrows from the original try
|
|
|
c401cc |
of 2df8d99:
|
|
|
c401cc |
|
|
|
c401cc |
A fresh checkout on a RHEL 6 machine with these packages:
|
|
|
c401cc |
kernel-headers-2.6.32-405.el6.x86_64
|
|
|
c401cc |
glibc-2.12-1.128.el6.x86_64
|
|
|
c401cc |
failed to configure with this message:
|
|
|
c401cc |
checking for linux/if_bridge.h... no
|
|
|
c401cc |
configure: error: You must install kernel-headers in order to compile libvirt with QEMU or LXC support
|
|
|
c401cc |
|
|
|
c401cc |
Digging in config.log, we see that the problem is identical to
|
|
|
c401cc |
what we fixed earlier in commit d12c2811:
|
|
|
c401cc |
|
|
|
c401cc |
configure:98831: checking for linux/if_bridge.h
|
|
|
c401cc |
configure:98853: gcc -std=gnu99 -c -g -O2 conftest.c >&5
|
|
|
c401cc |
In file included from /usr/include/linux/if_bridge.h:17,
|
|
|
c401cc |
from conftest.c:559:
|
|
|
c401cc |
/usr/include/linux/in6.h:31: error: redefinition of 'struct in6_addr'
|
|
|
c401cc |
/usr/include/linux/in6.h:48: error: redefinition of 'struct sockaddr_in6'
|
|
|
c401cc |
/usr/include/linux/in6.h:56: error: redefinition of 'struct ipv6_mreq'
|
|
|
c401cc |
configure:98860: $? = 1
|
|
|
c401cc |
|
|
|
c401cc |
I had not hit it earlier because I was using incremental builds,
|
|
|
c401cc |
where config.cache had shielded me from the kernel-headers breakage.
|
|
|
c401cc |
|
|
|
c401cc |
* configure.ac (if_bridge.h): Avoid conflicting type definitions.
|
|
|
c401cc |
* src/util/virnetdevbridge.c (includes): Also sanitize for RHEL 5.
|
|
|
c401cc |
|
|
|
c401cc |
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
c401cc |
(cherry picked from commit 70024dc9192038575ab5217ac35080b038e5b13e)
|
|
|
c401cc |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c401cc |
---
|
|
|
c401cc |
configure.ac | 12 +++++++++++-
|
|
|
c401cc |
src/util/virnetdevbridge.c | 4 ++++
|
|
|
c401cc |
2 files changed, 15 insertions(+), 1 deletion(-)
|
|
|
c401cc |
|
|
|
c401cc |
diff --git a/configure.ac b/configure.ac
|
|
|
c401cc |
index cdb2969..a000dcb 100644
|
|
|
c401cc |
--- a/configure.ac
|
|
|
c401cc |
+++ b/configure.ac
|
|
|
c401cc |
@@ -998,7 +998,17 @@ if test "$with_linux" = "yes"; then
|
|
|
c401cc |
if test "$with_qemu" = "yes" || test "$with_lxc" = "yes" ; then
|
|
|
c401cc |
AC_CHECK_HEADERS([linux/param.h linux/sockios.h linux/if_bridge.h linux/if_tun.h],,
|
|
|
c401cc |
[AC_MSG_ERROR([You must install kernel-headers in order to compile libvirt with QEMU or LXC support])],
|
|
|
c401cc |
- [[#include <netinet/in.h>
|
|
|
c401cc |
+ [[/* The kernel folks broke their headers when used with particular
|
|
|
c401cc |
+ * glibc versions; although the structs are ABI compatible, the
|
|
|
c401cc |
+ * C type system doesn't like struct redefinitions. We work around
|
|
|
c401cc |
+ * the problem here in the same manner as in virnetdevbridge.c. */
|
|
|
c401cc |
+ #include <netinet/in.h>
|
|
|
c401cc |
+ #define in6_addr in6_addr_
|
|
|
c401cc |
+ #define sockaddr_in6 sockaddr_in6_
|
|
|
c401cc |
+ #define ipv6_mreq ipv6_mreq_
|
|
|
c401cc |
+ #define in6addr_any in6addr_any_
|
|
|
c401cc |
+ #define in6addr_loopback in6addr_loopback_
|
|
|
c401cc |
+ #include <linux/in6.h>
|
|
|
c401cc |
]])
|
|
|
c401cc |
fi
|
|
|
c401cc |
fi
|
|
|
c401cc |
diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c
|
|
|
c401cc |
index 5d52e23..e4daa27 100644
|
|
|
c401cc |
--- a/src/util/virnetdevbridge.c
|
|
|
c401cc |
+++ b/src/util/virnetdevbridge.c
|
|
|
c401cc |
@@ -46,11 +46,15 @@
|
|
|
c401cc |
# define in6_addr in6_addr_
|
|
|
c401cc |
# define sockaddr_in6 sockaddr_in6_
|
|
|
c401cc |
# define ipv6_mreq ipv6_mreq_
|
|
|
c401cc |
+# define in6addr_any in6addr_any_
|
|
|
c401cc |
+# define in6addr_loopback in6addr_loopback_
|
|
|
c401cc |
# include <linux/in6.h>
|
|
|
c401cc |
# include <linux/if_bridge.h> /* SYSFS_BRIDGE_ATTR */
|
|
|
c401cc |
# undef in6_addr
|
|
|
c401cc |
# undef sockaddr_in6
|
|
|
c401cc |
# undef ipv6_mreq
|
|
|
c401cc |
+# undef in6addr_any
|
|
|
c401cc |
+# undef in6addr_loopback
|
|
|
c401cc |
|
|
|
c401cc |
# define JIFFIES_TO_MS(j) (((j)*1000)/HZ)
|
|
|
c401cc |
# define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)
|
|
|
c401cc |
--
|
|
|
c401cc |
1.8.5.3
|
|
|
c401cc |
|