[libvirt] [PATCH] check device-mapper when building without storage mpath

Osier Yang jyang at redhat.com
Fri Feb 18 08:21:20 UTC 2011


于 2011年02月18日 11:00, Wen Congyang 写道:
> When I build libvirt without libvirtd, I receive the following errors:
>    GEN    virsh.1
>    CCLD   virsh
> ../src/.libs/libvirt.so: undefined reference to `dm_is_dm_major'
> collect2: ld returned 1 exit status
> make[3]: *** [virsh] Error 1
>
> My build step:
> # ./autogen.sh --without-libvirtd
> # make dist
> # rpmbuild --nodeps --define "_sourcedir `pwd`" --define "_without_libvirtd 1" -ba libvirt.spec
>
> This bug was caused by commit df1011ca.
>
> Signed-off-by: Wen Congyang<wency at cn.fujitsu.com>
>
> ---
>   configure.ac |   35 ++++++++++++++++-------------------
>   1 files changed, 16 insertions(+), 19 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 2bb6918..0f81484 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1697,25 +1697,22 @@ 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_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
> -   if test "$DEVMAPPER_FOUND" = "no" ; then
> -     AC_MSG_ERROR([You must install device-mapper-devel/libdevmapper>= $DEVMAPPER_REQUIRED to compile libvirt])
> -   fi
> -
> +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_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
> +if test "$DEVMAPPER_FOUND" = "no" ; then
> +  AC_MSG_ERROR([You must install device-mapper-devel/libdevmapper>= $DEVMAPPER_REQUIRED to compile libvirt])
>   fi
>   AC_SUBST([DEVMAPPER_CFLAGS])
>   AC_SUBST([DEVMAPPER_LIBS])

Thanks for the fix, actually It can be reproduced simply by:
% ./autogen.sh --with-storage-mpath=no
% make

As src/util/util.c invokes "dm_is_dm_major".

ACK.

Regards,
Osier




More information about the libvir-list mailing list