[libvirt] [PATCH] fix rawhide/F13 --no-add-needed/dlopen-related build failures

Jim Meyering jim at meyering.net
Thu Mar 4 16:14:38 UTC 2010


Diego,

I saw no follow-up here,
  http://thread.gmane.org/gmane.comp.emulators.libvirt/21398/focus=21671
so I've fixed your two patches to address Eric's review feedback,
and confirmed that they solve the problem on Rawhide.

>From 55c182d89cd6e5417eafe9f4bdf2e0ef7f8721f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes at gmail.com>
Date: Thu, 4 Mar 2010 16:45:02 +0100
Subject: [PATCH 1/2] build: avoid dlopen-related link failure on rawhide/F13

Instead of using AC_CHECK_LIB and hardcoding -ldl, search for the library
needed to get dlopen() and then use the cached value.
---
 configure.ac |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 682b8b5..d5d62ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1700,7 +1700,7 @@ if test "x$with_driver_modules" = "xyes" ; then
   old_libs="$LIBS"
   fail=0
   AC_CHECK_HEADER([dlfcn.h],[],[fail=1])
-  AC_CHECK_LIB([dl], [dlopen],[],[fail=1])
+  AC_SEARCH_LIBS([dlopen], [dl], [], [fail=1])
   test $fail = 1 &&
       AC_MSG_ERROR([You must have dlfcn.h / dlopen() support to build driver modules])

@@ -1709,7 +1709,10 @@ if test "x$with_driver_modules" = "xyes" ; then
 fi
 if test "$with_driver_modules" = "yes"; then
   DRIVER_MODULE_CFLAGS="-export-dynamic"
-  DRIVER_MODULE_LIBS="-ldl"
+  case $ac_cv_search_dlopen in
+    no*) DRIVER_MODULE_LIBS= ;;
+    *) DRIVER_MODULE_LIBS=$ac_cv_search_dlopen ;;
+  esac
   AC_DEFINE_UNQUOTED([WITH_DRIVER_MODULES], 1, [whether to build drivers as modules])
 fi
 AM_CONDITIONAL([WITH_DRIVER_MODULES], [test "$with_driver_modules" != "no"])
--
1.7.0.1.475.gaf89b


>From ca7a9f299b0bd415f8434b3c9e6c70528d2f85cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= <flameeyes at gmail.com>
Date: Thu, 4 Mar 2010 16:48:10 +0100
Subject: [PATCH 2/2] build: vbox: avoid build failure when linking with --no-add-needed

With the recent changes to the linking defaults in Fedora 13 (namely
enabling --no-add-needed behaviour by default), we have to pass the
dlopen()-providing libraries directly at the link of the module; use the
same AC_SEARCH_LIBS function as used before to look for it and add it to
the Makefile.
---
 configure.ac    |    6 ++++++
 src/Makefile.am |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index d5d62ea..923d7b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -303,6 +303,12 @@ fi
 AM_CONDITIONAL([WITH_OPENVZ], [test "$with_openvz" = "yes"])

 if test "x$with_vbox" = "xyes"; then
+    AC_SEARCH_LIBS([dlopen], [dl], [], [AC_MSG_ERROR([Unable to find dlopen()])])
+    case $ac_cv_search_dlopen in
+      no*) DLOPEN_LIBS= ;;
+      *) DLOPEN_LIBS=$ac_cv_search_dlopen ;;
+    esac
+    AC_SUBST([DLOPEN_LIBS])
     AC_DEFINE_UNQUOTED([WITH_VBOX], 1, [whether VirtualBox driver is enabled])
 fi
 AM_CONDITIONAL([WITH_VBOX], [test "$with_vbox" = "yes"])
diff --git a/src/Makefile.am b/src/Makefile.am
index 2051e5d..67f8b6d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -463,6 +463,7 @@ libvirt_driver_vbox_la_CFLAGS = \
 if WITH_DRIVER_MODULES
 libvirt_driver_vbox_la_LDFLAGS = -module -avoid-version
 endif
+libvirt_driver_vbox_la_LIBADD = $(DLOPEN_LIBS)
 libvirt_driver_vbox_la_SOURCES = $(VBOX_DRIVER_SOURCES)
 endif

--
1.7.0.1.475.gaf89b




More information about the libvir-list mailing list