[libvirt] [PATCH] build: fix build with latest rawhide kernel headers
Daniel P. Berrange
berrange at redhat.com
Mon Sep 16 14:31:58 UTC 2013
On Fri, Sep 13, 2013 at 10:33:04AM -0600, Eric Blake wrote:
> Bother those kernel developers. In the latest rawhide, kernel
> and glibc have now been unified so that <netinet/in.h> and
> <linux/in6.h> no longer clash; but <linux/if_bridge.h> is still
> not self-contained. Because of the latest header change, the
> build is failing with:
>
> checking for linux/param.h... no
> configure: error: You must install kernel-headers in order to compile libvirt with QEMU or LXC support
>
> with details:
>
> In file included from conftest.c:561:0:
> /usr/include/linux/in6.h:71:18: error: field 'flr_dst' has incomplete type
> struct in6_addr flr_dst;
>
> We need a workaround to avoid our workaround :)
>
> * configure.ac (KERNEL_HEADERS_WORKAROUND): New test.
> * src/util/virnetdevbridge.c (includes): Use it.
>
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>
> This qualifies as a build-breaker; but last time I pushed a patch
> in this area of code without review, it got reverted, so I'll wait
> for the review.
>
> I've tested on RHEL 5, RHEL 6, Fedora 19 (all of which have glibc
> and kernel differences, although not the same error messages) and
> rawhide (where glibc and kernel finally agree, but where the kernel
> headers _still_ assume that the caller already declared ipv6 structs).
>
> configure.ac | 38 ++++++++++++++++++++++++++++----------
> src/util/virnetdevbridge.c | 24 ++++++++++++++----------
> 2 files changed, 42 insertions(+), 20 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 8426863..8acccdd 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1051,18 +1051,36 @@ dnl check for kernel headers required by src/bridge.c
> dnl
> if test "$with_linux" = "yes"; then
> if test "$with_qemu" = "yes" || test "$with_lxc" = "yes" ; then
> + # Various kernel versions have headers that are not self-standing, but
> + # yet are incompatible with the corresponding glibc headers. In order
> + # to guarantee compilation across a wide range of versions (from RHEL 5
> + # to rawhide), we first have to probe whether glibc and kernel can be
> + # used in tandem; and if not, provide workarounds that ensure that
> + # ABI-compatible IPv6 types are present for use by the kernel headers.
> + # These probes mirror the usage in virnetdevbridge.c
> + AC_CACHE_CHECK([whether kernel and glibc headers are compatible],
> + [lv_cv_kernel_glibc_compatible],
> + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
> + #include <netinet/in.h>
> + #include <linux/in6.h>
> + ]])],
> + [lv_cv_kernel_glibc_compatible=yes],
> + [lv_cv_kernel_glibc_compatible=no])])
> + if test "x$lv_cv_kernel_glibc_compatible" != xyes; then
> + AC_DEFINE([KERNEL_HEADERS_WORKAROUND], [1],
> + [define to 1 if Linux kernel headers require a workaround to avoid
> + compilation errors when mixed with glibc headers])
> + fi
nitpick - how about calling this LINUX_NETINET_IN_WORKAROUND or
something similarly specific about the header file that is actually
broken.
ACK
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 :|
More information about the libvir-list
mailing list