[libvirt] [PATCH] [Build-breaker : 1.2.12] Suppress compilation without dbus headers

Prerna Saxena prerna at linux.vnet.ibm.com
Sun Jan 25 12:26:25 UTC 2015

While testing 1.2.12 rc2 on Powerpc, Fedora 21, I hit a bunch of build failures in absence of dbus-devel :

src/util/virsystemd.c:284:17: note: in expansion of macro 'STREQ_NULLABLE'
             if (STREQ_NULLABLE("org.freedesktop.DBus.Error.UnknownMethod",
src/util/virsystemd.c:288:17: error: implicit declaration of function 'dbus_error_free' [-Werror=implicit-function-declaration]

Found that this was because commit 318df5a05 needs Dbus libraries for compilation, and configure didnt mark "with_dbus" to be mandatory. In this case, the compilation itself failed in a much uglier
fashion on my system where dbus-devel was absent.

The following patch introduces a compile error when dbus-devel is absent, so that the build itself proceeds later without cryptic errors.

This has also been reported on the list : https://www.redhat.com/archives/libvir-list/2015-January/msg00641.html

>From 8c4f583b6bb47ca41866ff884af0cd55487f047d Mon Sep 17 00:00:00 2001
From: Prerna Saxena <prerna at linux.vnet.ibm.com>
Date: Sun, 25 Jan 2015 05:35:23 -0600
Subject: [PATCH] Build: Fix dbus m4 macro to correctly flag it as a required

Commit 318df5a needs dbus headers to compile. However, this package
is listed as optional, and so this breaks libvirt compilation
on systems that lack the relevant devel files.

This patch does not allow ./configure to proceed if dbus-devel is absent.

It also tweaks the libvirt spec file to reflect this relationship.
 libvirt.spec.in | 3 ---
 m4/virt-dbus.m4 | 1 +
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/libvirt.spec.in b/libvirt.spec.in
index ba1cf41..4dfda13 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -627,10 +627,7 @@ BuildRequires: util-linux
 BuildRequires: nfs-utils
-%if %{with_firewalld}
-# Communication with the firewall daemon uses DBus
 BuildRequires: dbus-devel
 # Fedora build root suckage
 BuildRequires: gawk
diff --git a/m4/virt-dbus.m4 b/m4/virt-dbus.m4
index 3f9b306..42359cf 100644
--- a/m4/virt-dbus.m4
+++ b/m4/virt-dbus.m4
@@ -19,6 +19,7 @@ dnl
   LIBVIRT_CHECK_PKG([DBUS], [dbus-1], [1.0.0])
+  m4_divert_text([DEFAULTS], [with_dbus=yes])
   if test "$with_dbus" = "yes" ; then

Prerna Saxena

Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India

More information about the libvir-list mailing list