Maximilian Wilhelm <max(a)rfc2324.org> wrote:
The 'getVer' fix introducted in
02a72b420670718640d9abf0e07f2b1cca7b4d2b
breaks compiling libvirt with loadable module support.
Work around this to get it building again.
Signed-off-by: Maximilian Wilhelm <max(a)rfc2324.org>
---
src/libvirt.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index ae076d1..038a1ac 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -803,7 +803,13 @@ virGetVersion(unsigned long *libVer, const char *type,
if (typeVer != NULL) {
if (type == NULL)
type = "Xen";
+
+/* FIXME: Add _proper_ type version handling for loadable driver modules... */
+#ifdef WITH_DRIVER_MODULES
+ *typeVer = LIBVIR_VERSION_NUMBER;
+#else
*typeVer = 0;
+
#if WITH_XEN
if (STRCASEEQ(type, "Xen"))
*typeVer = xenUnifiedVersion();
@@ -836,6 +842,7 @@ virGetVersion(unsigned long *libVer, const char *type,
virLibConnError(NULL, VIR_ERR_NO_SUPPORT, type);
return (-1);
}
+#endif /* WITH_DRIVER_MODULES */
}
return (0);
}
Thanks for the patch.
I note that this link failure happens when you configure
--with-driver-modules.
As you suggest with the FIXME comment, there's room for
improvement in this area.
For example, with more than one of the various modules,
we'd actually want all of their version strings, not just
the one that happens to be listed last in the code.
Or perhaps, a method to obtain a list of loaded/loadable modules,
and another to query a module for its version string.
#if WITH_XEN
if (STRCASEEQ(type, "Xen"))
*typeVer = xenUnifiedVersion();
#endif
#if WITH_TEST
if (STRCASEEQ(type, "Test"))
*typeVer = LIBVIR_VERSION_NUMBER;
#endif
#if WITH_QEMU
if (STRCASEEQ(type, "QEMU"))
*typeVer = LIBVIR_VERSION_NUMBER;
#endif
#if WITH_LXC
if (STRCASEEQ(type, "LXC"))
*typeVer = LIBVIR_VERSION_NUMBER;
#endif
#if WITH_OPENVZ
if (STRCASEEQ(type, "OpenVZ"))
*typeVer = LIBVIR_VERSION_NUMBER;
#endif
#if WITH_UML
if (STRCASEEQ(type, "UML"))
*typeVer = LIBVIR_VERSION_NUMBER;
#endif
#if WITH_REMOTE
if (STRCASEEQ(type, "Remote"))
*typeVer = remoteVersion();
#endif
However, even with your patch, the latest sources don't link for me.
I get this:
/c/libvirt/qemud/qemud.c:840: undefined reference to `virDriverLoadModule'
The patch below fixes that:
From 3c6565f6e78e4a0da898248c07a59033aa111ef7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 16 Feb 2009 12:57:28 +0100
Subject: [PATCH] Avoid link failure when configured --with-driver-modules
* qemud/Makefile.am (WITH_DRIVER_MODULES): Link with libvirt_driver.la
and libvirt_util.la. Indent for readability.
---
qemud/Makefile.am | 41 ++++++++++++++++++++++-------------------
1 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/qemud/Makefile.am b/qemud/Makefile.am
index a0c161a..498f05c 100644
--- a/qemud/Makefile.am
+++ b/qemud/Makefile.am
@@ -104,30 +104,33 @@ libvirtd_LDADD = \
$(SASL_LIBS) \
$(POLKIT_LIBS)
-if ! WITH_DRIVER_MODULES
-if WITH_QEMU
-libvirtd_LDADD += ../src/libvirt_driver_qemu.la
-endif
+if WITH_DRIVER_MODULES
+ libvirtd_LDADD += ../src/libvirt_driver.la
+ libvirtd_LDADD += ../src/libvirt_util.la
+else
+ if WITH_QEMU
+ libvirtd_LDADD += ../src/libvirt_driver_qemu.la
+ endif
-if WITH_LXC
-libvirtd_LDADD += ../src/libvirt_driver_lxc.la
-endif
+ if WITH_LXC
+ libvirtd_LDADD += ../src/libvirt_driver_lxc.la
+ endif
-if WITH_UML
-libvirtd_LDADD += ../src/libvirt_driver_uml.la
-endif
+ if WITH_UML
+ libvirtd_LDADD += ../src/libvirt_driver_uml.la
+ endif
-if WITH_STORAGE_DIR
-libvirtd_LDADD += ../src/libvirt_driver_storage.la
-endif
+ if WITH_STORAGE_DIR
+ libvirtd_LDADD += ../src/libvirt_driver_storage.la
+ endif
-if WITH_NETWORK
-libvirtd_LDADD += ../src/libvirt_driver_network.la
-endif
+ if WITH_NETWORK
+ libvirtd_LDADD += ../src/libvirt_driver_network.la
+ endif
-if WITH_NODE_DEVICES
-libvirtd_LDADD += ../src/libvirt_driver_nodedev.la
-endif
+ if WITH_NODE_DEVICES
+ libvirtd_LDADD += ../src/libvirt_driver_nodedev.la
+ endif
endif
libvirtd_LDADD += ../src/libvirt.la
--
1.6.2.rc0.264.g60787