Re: [PATCH] build: fix broken mingw cross-compilation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 02/19/2011 03:08 AM, Eric Blake Write:
> Two regressions:
> Commit df1011ca broke builds for systems that lack devmapper
> (non-Linux, as well as Linux with ./autogen.sh --without-libvirtd
> and without the libraries present).
> Commit ce6fd650 broke cross-compilation, due to a gnulib bug.
> 
> * .gnulib: Update to latest, for cross-compilation fix.
> * src/util/util.c (virIsDevMapperDevice): Provide stub for
> platforms not using storage driver.
> * configure.ac (devmapper): Arrange to define HAVE_LIBDEVMAPPER_H.
> devmapper issue reported by Wen Congyang.
> ---
> 
> Thankfully, neither regression was in the 0.8.7 release.
> 
> Pushing this under the build-breaker rule, as verified by
> ./autobuild.sh.
> 
> * .gnulib aa0f5d7...17adb5d (9):
>   > longlong: skip, rather than fail, on cross-compilation
>   > * NEWS: Mention 2011-02-08 change to stdlib.
>   > getloadavg: Add comments about platforms.
>   > getloadavg: Fix link error on Solaris 2.6.
>   > * lib/getloadavg.c (getloadavg) [sgi]: Make ldav_off of type ptrdiff_t.
>   > Oops, fix syntax error in last config.rpath commit.
>   > havelib: Fix comments.
>   > havelib: Update config.rpath.
>   > getloadavg test: Add some plausibility checks.
> 
>  .gnulib         |    2 +-
>  configure.ac    |    2 +-
>  src/util/util.c |   11 ++++++++++-
>  3 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/.gnulib b/.gnulib
> index aa0f5d7..17adb5d 160000
> --- a/.gnulib
> +++ b/.gnulib
> @@ -1 +1 @@
> -Subproject commit aa0f5d7586efe7044f6ca9e07be3f579ee0d5618
> +Subproject commit 17adb5d75404cf6cdde0eb3b2edc6110d9fa8001
> diff --git a/configure.ac b/configure.ac
> index f79babb..2b26e57 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1711,12 +1711,12 @@ if test "$with_storage_mpath" = "yes"; then
>       save_LIBS="$LIBS"
>       save_CFLAGS="$CFLAGS"
>       DEVMAPPER_FOUND=yes
> -     AC_CHECK_HEADER([libdevmapper.h],,[DEVMAPPER_FOUND=no])
>       AC_CHECK_LIB([devmapper], [dm_task_run],,[DEVMAPPER_FOUND=no])
>       DEVMAPPER_LIBS="-ldevmapper"
>       LIBS="$save_LIBS"
>       CFLAGS="$save_CFLAGS"
>     fi
> +   AC_CHECK_HEADERS([libdevmapper.h],,[DEVMAPPER_FOUND=no])
>     if test "$DEVMAPPER_FOUND" = "no" ; then
>       AC_MSG_ERROR([You must install device-mapper-devel/libdevmapper >= $DEVMAPPER_REQUIRED to compile libvirt])
>     fi

Currently, we need virIsDevMapperDevice() when we build libvirt with disk or mpath storage drivers.
So we should check device-mapper-devel when we build with disk storage driver but without mpath storage
driver.

# ./autogen.sh --without-storage-mpath
configure: Configuration summary
configure: =====================
...
configure: Storage Drivers
configure: 
configure:      Dir: yes
configure:       FS: yes
configure:    NetFS: yes
configure:      LVM: yes
configure:    iSCSI: yes
configure:     SCSI: yes
configure:    mpath: no
configure:     Disk: yes
configure: 
...

# cat config.h
...
/* Define to 1 if you have the `cap-ng' library (-lcap-ng). */
#define HAVE_LIBCAP_NG 1

/* Define to 1 if you have the `devmapper' library (-ldevmapper). */
/* #undef HAVE_LIBDEVMAPPER */

/* Define to 1 if you have the <libdevmapper.h> header file. */
/* #undef HAVE_LIBDEVMAPPER_H */

/* Define to 1 if you have the `gnutls' library (-lgnutls). */
/* #undef HAVE_LIBGNUTLS */
...

The following patch can fix this problem.

>From f4f98bc428e2d57602921be457203c691c8fe4e4 Mon Sep 17 00:00:00 2001
From: Wen Congyang <wency@xxxxxxxxxxxxxx>
Date: Mon, 21 Feb 2011 09:55:18 +0800
Subject: [PATCH] check device-mapper when building with mpath or disk storage driver

---
 configure.ac |   47 ++++++++++++++++++++++++-----------------------
 1 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2b26e57..bd509f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1702,29 +1702,6 @@ if test "$with_storage_mpath" = "check" && test "$with_linux" = "yes"; then
 fi
 AM_CONDITIONAL([WITH_STORAGE_MPATH], [test "$with_storage_mpath" = "yes"])
 
-if test "$with_storage_mpath" = "yes"; then
-   DEVMAPPER_CFLAGS=
-   DEVMAPPER_LIBS=
-   PKG_CHECK_MODULES([DEVMAPPER], [devmapper >= $DEVMAPPER_REQUIRED], [], [DEVMAPPER_FOUND=no])
-   if test "$DEVMAPPER_FOUND" = "no"; then
-     # devmapper is missing pkg-config files in ubuntu, suse, etc
-     save_LIBS="$LIBS"
-     save_CFLAGS="$CFLAGS"
-     DEVMAPPER_FOUND=yes
-     AC_CHECK_LIB([devmapper], [dm_task_run],,[DEVMAPPER_FOUND=no])
-     DEVMAPPER_LIBS="-ldevmapper"
-     LIBS="$save_LIBS"
-     CFLAGS="$save_CFLAGS"
-   fi
-   AC_CHECK_HEADERS([libdevmapper.h],,[DEVMAPPER_FOUND=no])
-   if test "$DEVMAPPER_FOUND" = "no" ; then
-     AC_MSG_ERROR([You must install device-mapper-devel/libdevmapper >= $DEVMAPPER_REQUIRED to compile libvirt])
-   fi
-
-fi
-AC_SUBST([DEVMAPPER_CFLAGS])
-AC_SUBST([DEVMAPPER_LIBS])
-
 LIBPARTED_CFLAGS=
 LIBPARTED_LIBS=
 if test "$with_storage_disk" = "yes" ||
@@ -1786,6 +1763,30 @@ AM_CONDITIONAL([WITH_STORAGE_DISK], [test "$with_storage_disk" = "yes"])
 AC_SUBST([LIBPARTED_CFLAGS])
 AC_SUBST([LIBPARTED_LIBS])
 
+if test "$with_storage_mpath" = "yes" ||
+   test "$with_storage_disk" = "yes"; then
+   DEVMAPPER_CFLAGS=
+   DEVMAPPER_LIBS=
+   PKG_CHECK_MODULES([DEVMAPPER], [devmapper >= $DEVMAPPER_REQUIRED], [], [DEVMAPPER_FOUND=no])
+   if test "$DEVMAPPER_FOUND" = "no"; then
+     # devmapper is missing pkg-config files in ubuntu, suse, etc
+     save_LIBS="$LIBS"
+     save_CFLAGS="$CFLAGS"
+     DEVMAPPER_FOUND=yes
+     AC_CHECK_LIB([devmapper], [dm_task_run],,[DEVMAPPER_FOUND=no])
+     DEVMAPPER_LIBS="-ldevmapper"
+     LIBS="$save_LIBS"
+     CFLAGS="$save_CFLAGS"
+   fi
+   AC_CHECK_HEADERS([libdevmapper.h],,[DEVMAPPER_FOUND=no])
+   if test "$DEVMAPPER_FOUND" = "no" ; then
+     AC_MSG_ERROR([You must install device-mapper-devel/libdevmapper >= $DEVMAPPER_REQUIRED to compile libvirt])
+   fi
+
+fi
+AC_SUBST([DEVMAPPER_CFLAGS])
+AC_SUBST([DEVMAPPER_LIBS])
+
 dnl
 dnl check for libcurl (ESX/XenAPI)
 dnl
-- 
1.7.1


> diff --git a/src/util/util.c b/src/util/util.c
> index a7ce4b3..cbdae67 100644
> --- a/src/util/util.c
> +++ b/src/util/util.c
> @@ -45,7 +45,9 @@
>  #include <string.h>
>  #include <signal.h>
>  #include <termios.h>
> -#include <libdevmapper.h>
> +#if HAVE_LIBDEVMAPPER_H
> +# include <libdevmapper.h>
> +#endif
>  #include "c-ctype.h"
> 
>  #ifdef HAVE_PATHS_H
> @@ -3125,6 +3127,7 @@ virTimestamp(void)
>      return timestamp;
>  }
> 
> +#if HAVE_LIBDEVMAPPER_H
>  bool
>  virIsDevMapperDevice(const char *devname)
>  {
> @@ -3137,3 +3140,9 @@ virIsDevMapperDevice(const char *devname)
> 
>      return false;
>  }
> +#else
> +bool virIsDevMapperDevice(const char *devname ATTRIBUTE_UNUSED)
> +{
> +    return false;
> +}
> +#endif

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]