[libvirt] [PATCH] build: fix building error when building without libvirtd

When building libvirt without libvirtd, we will receive the following error message: make[3]: Entering directory `/home/wency/rpmbuild/BUILD/libvirt-0.9.2/tools' CC virsh-virsh.o CC virsh-console.o GEN virt-xml-validate GEN virt-pki-validate CCLD virsh ../src/.libs/libvirt.so: undefined reference to `numa_available' ../src/.libs/libvirt.so: undefined reference to `numa_max_node' collect2: ld returned 1 exit status The reason is that: we check numactl only when building qemu driver, and qemu driver will not be built when bulding without libvirtd. So with_numactl's value is check and we will not link libnuma.so. In the other function, we call numa_available() and numa_max_node() only when HAVE_NUMACTL is 1. We should do the same check in the function nodeGetMemoryStats(). --- src/nodeinfo.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 647cb1e..c6dbb84 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -685,17 +685,23 @@ int nodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED, return -1; } } else { +#if HAVE_NUMACTL if (numa_available() < 0) { +#endif nodeReportError(VIR_ERR_NO_SUPPORT, "%s", _("NUMA not supported on this host")); return -1; +#if HAVE_NUMACTL } +#endif +#if HAVE_NUMACTL if (cellNum > numa_max_node()) { nodeReportError(VIR_ERR_INVALID_ARG, "%s", _("Invalid cell number")); return -1; } +#endif if (virAsprintf(&meminfo_path, "%s/node%d/meminfo", NODE_SYS_PATH, cellNum) < 0) { -- 1.7.1

On Mon, Jun 20, 2011 at 10:48:07AM +0800, Wen Congyang wrote:
When building libvirt without libvirtd, we will receive the following error message:
make[3]: Entering directory `/home/wency/rpmbuild/BUILD/libvirt-0.9.2/tools' CC virsh-virsh.o CC virsh-console.o GEN virt-xml-validate GEN virt-pki-validate CCLD virsh ../src/.libs/libvirt.so: undefined reference to `numa_available' ../src/.libs/libvirt.so: undefined reference to `numa_max_node' collect2: ld returned 1 exit status
The reason is that: we check numactl only when building qemu driver, and qemu driver will not be built when bulding without libvirtd. So with_numactl's value is check and we will not link libnuma.so.
In the other function, we call numa_available() and numa_max_node() only when HAVE_NUMACTL is 1. We should do the same check in the function nodeGetMemoryStats().
--- src/nodeinfo.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 647cb1e..c6dbb84 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -685,17 +685,23 @@ int nodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED, return -1; } } else { +#if HAVE_NUMACTL if (numa_available() < 0) { +#endif nodeReportError(VIR_ERR_NO_SUPPORT, "%s", _("NUMA not supported on this host")); return -1; +#if HAVE_NUMACTL } +#endif
+#if HAVE_NUMACTL if (cellNum > numa_max_node()) { nodeReportError(VIR_ERR_INVALID_ARG, "%s", _("Invalid cell number")); return -1; } +#endif
if (virAsprintf(&meminfo_path, "%s/node%d/meminfo", NODE_SYS_PATH, cellNum) < 0) {
ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

At 06/20/2011 12:28 PM, Daniel Veillard Write:
On Mon, Jun 20, 2011 at 10:48:07AM +0800, Wen Congyang wrote:
When building libvirt without libvirtd, we will receive the following error message:
make[3]: Entering directory `/home/wency/rpmbuild/BUILD/libvirt-0.9.2/tools' CC virsh-virsh.o CC virsh-console.o GEN virt-xml-validate GEN virt-pki-validate CCLD virsh ../src/.libs/libvirt.so: undefined reference to `numa_available' ../src/.libs/libvirt.so: undefined reference to `numa_max_node' collect2: ld returned 1 exit status
The reason is that: we check numactl only when building qemu driver, and qemu driver will not be built when bulding without libvirtd. So with_numactl's value is check and we will not link libnuma.so.
In the other function, we call numa_available() and numa_max_node() only when HAVE_NUMACTL is 1. We should do the same check in the function nodeGetMemoryStats().
--- src/nodeinfo.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 647cb1e..c6dbb84 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -685,17 +685,23 @@ int nodeGetMemoryStats(virConnectPtr conn ATTRIBUTE_UNUSED, return -1; } } else { +#if HAVE_NUMACTL if (numa_available() < 0) { +#endif nodeReportError(VIR_ERR_NO_SUPPORT, "%s", _("NUMA not supported on this host")); return -1; +#if HAVE_NUMACTL } +#endif
+#if HAVE_NUMACTL if (cellNum > numa_max_node()) { nodeReportError(VIR_ERR_INVALID_ARG, "%s", _("Invalid cell number")); return -1; } +#endif
if (virAsprintf(&meminfo_path, "%s/node%d/meminfo", NODE_SYS_PATH, cellNum) < 0) {
ACK,
Thanks, pushed. Wen Congyang
Daniel
participants (2)
-
Daniel Veillard
-
Wen Congyang