[libvirt] [PATCH] build: fix configure detection of if_bridge.h on RHEL 6

A fresh checkout on a RHEL 6 machine with these packages: kernel-headers-2.6.32-405.el6.x86_64 glibc-2.12-1.128.el6.x86_64 failed to configure with this message: checking for linux/if_bridge.h... no configure: error: You must install kernel-headers in order to compile libvirt with QEMU or LXC support Digging in config.log, we see that the problem is identical to what we fixed earlier in commit d12c2811: configure:98831: checking for linux/if_bridge.h configure:98853: gcc -std=gnu99 -c -g -O2 conftest.c >&5 In file included from /usr/include/linux/if_bridge.h:17, from conftest.c:559: /usr/include/linux/in6.h:31: error: redefinition of 'struct in6_addr' /usr/include/linux/in6.h:48: error: redefinition of 'struct sockaddr_in6' /usr/include/linux/in6.h:56: error: redefinition of 'struct ipv6_mreq' configure:98860: $? = 1 I had not hit it earlier because I was using incremental builds, where config.cache had shielded me from the kernel-headers breakage. * configure.ac (if_bridge.h): Avoid conflicting type definitions. Signed-off-by: Eric Blake <eblake@redhat.com> --- Pushing under the build-breaker rule, and backporting to v1.1.1-maint configure.ac | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 944a870..02f3e4a 100644 --- a/configure.ac +++ b/configure.ac @@ -999,7 +999,14 @@ if test "$with_linux" = "yes"; then if test "$with_qemu" = "yes" || test "$with_lxc" = "yes" ; then AC_CHECK_HEADERS([linux/param.h linux/sockios.h linux/if_bridge.h linux/if_tun.h],, [AC_MSG_ERROR([You must install kernel-headers in order to compile libvirt with QEMU or LXC support])], - [[#include <netinet/in.h> + [[/* The kernel folks broke their headers when used with particular + * glibc versions; although the structs are ABI compatible, the + * C type system doesn't like struct redefinitions. We work around + * the problem here in the same manner as in virnetdevbridge.c. */ + #include <netinet/in.h> + #define in6_addr in6_addr_ + #define sockaddr_in6 sockaddr_in6_ + #define ipv6_mreq ipv6_mreq_ ]]) fi fi -- 1.8.3.1

On Tue, Aug 06, 2013 at 02:41:55PM -0600, Eric Blake wrote:
A fresh checkout on a RHEL 6 machine with these packages: kernel-headers-2.6.32-405.el6.x86_64 glibc-2.12-1.128.el6.x86_64 failed to configure with this message: checking for linux/if_bridge.h... no configure: error: You must install kernel-headers in order to compile libvirt with QEMU or LXC support
Digging in config.log, we see that the problem is identical to what we fixed earlier in commit d12c2811:
configure:98831: checking for linux/if_bridge.h configure:98853: gcc -std=gnu99 -c -g -O2 conftest.c >&5 In file included from /usr/include/linux/if_bridge.h:17, from conftest.c:559: /usr/include/linux/in6.h:31: error: redefinition of 'struct in6_addr' /usr/include/linux/in6.h:48: error: redefinition of 'struct sockaddr_in6' /usr/include/linux/in6.h:56: error: redefinition of 'struct ipv6_mreq' configure:98860: $? = 1
I had not hit it earlier because I was using incremental builds, where config.cache had shielded me from the kernel-headers breakage.
* configure.ac (if_bridge.h): Avoid conflicting type definitions.
Signed-off-by: Eric Blake <eblake@redhat.com> ---
Pushing under the build-breaker rule, and backporting to v1.1.1-maint
This change breaks configure on any Fedora install I have, so I've had to revert it in master, since broken Fedora is more of a show stopper than broken RHEL6. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 08/07/2013 05:01 AM, Daniel P. Berrange wrote:
On Tue, Aug 06, 2013 at 02:41:55PM -0600, Eric Blake wrote:
A fresh checkout on a RHEL 6 machine with these packages: kernel-headers-2.6.32-405.el6.x86_64 glibc-2.12-1.128.el6.x86_64 failed to configure with this message: checking for linux/if_bridge.h... no configure: error: You must install kernel-headers in order to compile libvirt with QEMU or LXC support
I had not hit it earlier because I was using incremental builds, where config.cache had shielded me from the kernel-headers breakage.
* configure.ac (if_bridge.h): Avoid conflicting type definitions.
Signed-off-by: Eric Blake <eblake@redhat.com> ---
Pushing under the build-breaker rule, and backporting to v1.1.1-maint
This change breaks configure on any Fedora install I have, so I've had to revert it in master, since broken Fedora is more of a show stopper than broken RHEL6.
Arrgh - this time, the incremental build on Fedora bit me. I hate that the use of <linux/if_bridge.h> is broken depending on platform, with opposite conditions on whether you include or avoid <netinet/in.h>; the kernel folks really botched this one. :( I'll come up with a v2. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 08/06/2013 02:41 PM, Eric Blake wrote:
A fresh checkout on a RHEL 6 machine with these packages: kernel-headers-2.6.32-405.el6.x86_64 glibc-2.12-1.128.el6.x86_64 failed to configure with this message: checking for linux/if_bridge.h... no configure: error: You must install kernel-headers in order to compile libvirt with QEMU or LXC support
+++ b/configure.ac @@ -999,7 +999,14 @@ if test "$with_linux" = "yes"; then if test "$with_qemu" = "yes" || test "$with_lxc" = "yes" ; then AC_CHECK_HEADERS([linux/param.h linux/sockios.h linux/if_bridge.h linux/if_tun.h],, [AC_MSG_ERROR([You must install kernel-headers in order to compile libvirt with QEMU or LXC support])], - [[#include <netinet/in.h> + [[/* The kernel folks broke their headers when used with particular + * glibc versions; although the structs are ABI compatible, the + * C type system doesn't like struct redefinitions. We work around + * the problem here in the same manner as in virnetdevbridge.c. */
Except that v1 didn't EXACTLY match virnetdevbridge.c.
+ #include <netinet/in.h> + #define in6_addr in6_addr_ + #define sockaddr_in6 sockaddr_in6_ + #define ipv6_mreq ipv6_mreq_ ]])
This is the missing piece: diff --git i/configure.ac w/configure.ac index 4f2a7e9..4d6698d 100644 --- i/configure.ac +++ w/configure.ac @@ -1005,6 +1005,7 @@ if test "$with_linux" = "yes"; then #define in6_addr in6_addr_ #define sockaddr_in6 sockaddr_in6_ #define ipv6_mreq ipv6_mreq_ + #include <linux/in6.h> ]]) fi fi I've now tested fresh checkouts on RHEL5, RHEL6, Fedora 19, and FreeBSD; since all of them are able to pass configure, I'm going to repost the patch as a v2; but since the build failed last time around when invoking the build-breaker rule, this time around I'll wait for a review. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Daniel P. Berrange
-
Eric Blake