Skip to contentSkip to conversation

fix build problems on SLES11SP3

PATCH New Cornelia Huck 1 participant 2 messages Apr 2, 2015

lore
Share & tools
lore
#0 lore raw

cover fix build problems on SLES11SP3

This patch fixes building on SLES11SP3 which reports glib version 2.22 but includes a backport of g_get_monotonic_time() - leading to build errors.

This patch is a workaround for those glib versions. I verified that it now builds fine on our SLES11SP3 system and on systems with newer glib, but it would be nice if someone on a system with an actual glib 2.22..27 without the backport could give it a whirl.

I think this patch is applicable for 2.3.

Cornelia Huck (1):
glib-compat: fix problems with not-quite glib 2.22

 include/glib-compat.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Signature · 1 line
2.3.5
#1 lore raw

PATCH 1/1 glib-compat: fix problems with not-quite glib 2.22

Commit 89b516d8b9444ece8ccabb322a9389587c7a7b83 ("glib: add compatibility interface for g_get_monotonic_time()") aimed at making qemu build with old glib versions. At least SLES11SP3, however, contains a backport of g_get_monotonic_time() while keeping the reported glib version at 2.22.

Let's work around this by a strategically placed #define.

---
 include/glib-compat.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/glib-compat.h +3 -1
index f0615c9..011352b 100644
@@ -32,7 +32,7 @@ static inline guint g_timeout_add_seconds(guint interval, GSourceFunc function,
 #endif
 
 #if !GLIB_CHECK_VERSION(2, 28, 0)
-static inline gint64 g_get_monotonic_time(void)
+static inline gint64 qemu_g_get_monotonic_time(void)
 {
     /* g_get_monotonic_time() is best-effort so we can use the wall clock as a
      * fallback.
@@ -43,6 +43,8 @@ static inline gint64 g_get_monotonic_time(void)
 
     return time.tv_sec * G_TIME_SPAN_SECOND + time.tv_usec;
 }
+/* work around distro backports of this interface */
+#define g_get_monotonic_time() qemu_g_get_monotonic_time()
 #endif
 
 #if !GLIB_CHECK_VERSION(2, 16, 0)
Signature · 1 line
2.3.5