mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-20 19:45:22 +00:00
build: fix build with latest rawhide kernel headers
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 (NETINET_LINUX_WORKAROUND): New test. * src/util/virnetdevbridge.c (includes): Use it. Signed-off-by: Eric Blake <eblake@redhat.com> (cherry picked from commit e62e0094dcd0ca1484491a9cc62919473b647f11)
This commit is contained in:
parent
d5f89a6dd7
commit
aeb1776d51
29
configure.ac
29
configure.ac
@ -995,18 +995,37 @@ dnl check for kernel headers required by src/bridge.c
|
|||||||
dnl
|
dnl
|
||||||
if test "$with_linux" = "yes"; then
|
if test "$with_linux" = "yes"; then
|
||||||
if test "$with_qemu" = "yes" || test "$with_lxc" = "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 <linux/*.h> and <netinet/*.h> headers are compatible],
|
||||||
|
[lv_cv_netinet_linux_compatible],
|
||||||
|
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <linux/in6.h>
|
||||||
|
]])],
|
||||||
|
[lv_cv_netinet_linux_compatible=yes],
|
||||||
|
[lv_cv_netinet_linux_compatible=no])])
|
||||||
|
if test "x$lv_cv_netinet_linux_compatible" != xyes; then
|
||||||
|
AC_DEFINE([NETINET_LINUX_WORKAROUND], [1],
|
||||||
|
[define to 1 if Linux kernel headers require a workaround to avoid
|
||||||
|
compilation errors when mixed with glibc netinet headers])
|
||||||
|
fi
|
||||||
AC_CHECK_HEADERS([linux/param.h linux/sockios.h linux/if_bridge.h linux/if_tun.h],,
|
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])],
|
[AC_MSG_ERROR([You must install kernel-headers in order to compile libvirt with QEMU or LXC support])],
|
||||||
[[/* The kernel folks broke their headers when used with particular
|
[[#include <netinet/in.h>
|
||||||
* glibc versions; although the structs are ABI compatible, the
|
#if NETINET_LINUX_WORKAROUND
|
||||||
* 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 in6_addr in6_addr_
|
||||||
# define sockaddr_in6 sockaddr_in6_
|
# define sockaddr_in6 sockaddr_in6_
|
||||||
# define ipv6_mreq ipv6_mreq_
|
# define ipv6_mreq ipv6_mreq_
|
||||||
# define in6addr_any in6addr_any_
|
# define in6addr_any in6addr_any_
|
||||||
# define in6addr_loopback in6addr_loopback_
|
# define in6addr_loopback in6addr_loopback_
|
||||||
|
#endif
|
||||||
#include <linux/in6.h>
|
#include <linux/in6.h>
|
||||||
]])
|
]])
|
||||||
fi
|
fi
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
# include <linux/sockios.h>
|
# include <linux/sockios.h>
|
||||||
# include <linux/param.h> /* HZ */
|
# include <linux/param.h> /* HZ */
|
||||||
|
# if NETINET_LINUX_WORKAROUND
|
||||||
/* Depending on the version of kernel vs. glibc, there may be a collision
|
/* Depending on the version of kernel vs. glibc, there may be a collision
|
||||||
* between <net/in.h> and kernel IPv6 structures. The different types
|
* between <net/in.h> and kernel IPv6 structures. The different types
|
||||||
* are ABI compatible, but choke the C type system; work around it by
|
* are ABI compatible, but choke the C type system; work around it by
|
||||||
@ -48,13 +49,16 @@
|
|||||||
# define ipv6_mreq ipv6_mreq_
|
# define ipv6_mreq ipv6_mreq_
|
||||||
# define in6addr_any in6addr_any_
|
# define in6addr_any in6addr_any_
|
||||||
# define in6addr_loopback in6addr_loopback_
|
# define in6addr_loopback in6addr_loopback_
|
||||||
|
# endif
|
||||||
# include <linux/in6.h>
|
# include <linux/in6.h>
|
||||||
# include <linux/if_bridge.h> /* SYSFS_BRIDGE_ATTR */
|
# include <linux/if_bridge.h> /* SYSFS_BRIDGE_ATTR */
|
||||||
|
# if NETINET_LINUX_WORKAROUND
|
||||||
# undef in6_addr
|
# undef in6_addr
|
||||||
# undef sockaddr_in6
|
# undef sockaddr_in6
|
||||||
# undef ipv6_mreq
|
# undef ipv6_mreq
|
||||||
# undef in6addr_any
|
# undef in6addr_any
|
||||||
# undef in6addr_loopback
|
# undef in6addr_loopback
|
||||||
|
# endif
|
||||||
|
|
||||||
# define JIFFIES_TO_MS(j) (((j)*1000)/HZ)
|
# define JIFFIES_TO_MS(j) (((j)*1000)/HZ)
|
||||||
# define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)
|
# define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user