libxl: fix build with older glibc
diff mbox series

Message ID 20200225123343.26619-1-pdurrant@amazon.com
State New
Headers show
Series
  • libxl: fix build with older glibc
Related show

Commit Message

Paul Durrant Feb. 25, 2020, 12:33 p.m. UTC
Commit 2b02882ebbbc "libxl: add infrastructure to track and query
'recent' domids" added a call to clock_gettime() into libxl. The man-
page for this states:

"Link with -lrt (only for glibc versions before 2.17)."

Unfortunately Centos 6 does have an glibc prior to that version, and the
libxl Makefile was not updated to add '-lrt' so the build will fail in
that environment.

This patch simply adds '-lrt' to LIBXL_LIBS unconditionally, as it does
no harm in newer environments.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Fixes: 2b02882ebbbc ("libxl: add infrastructure to track and query 'recent' domids")
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wl@xen.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libxl/Makefile | 3 +++
 1 file changed, 3 insertions(+)

Comments

Wei Liu Feb. 25, 2020, 12:58 p.m. UTC | #1
On Tue, Feb 25, 2020 at 12:33:43PM +0000, Paul Durrant wrote:
> Commit 2b02882ebbbc "libxl: add infrastructure to track and query
> 'recent' domids" added a call to clock_gettime() into libxl. The man-
> page for this states:
> 
> "Link with -lrt (only for glibc versions before 2.17)."
> 
> Unfortunately Centos 6 does have an glibc prior to that version, and the
> libxl Makefile was not updated to add '-lrt' so the build will fail in
> that environment.
> 
> This patch simply adds '-lrt' to LIBXL_LIBS unconditionally, as it does
> no harm in newer environments.
> 
> Signed-off-by: Paul Durrant <pdurrant@amazon.com>
> Fixes: 2b02882ebbbc ("libxl: add infrastructure to track and query 'recent' domids")

Acked-by: Wei Liu <wl@xen.org>

Patch
diff mbox series

diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index ed41e4ee3e..69fcf21577 100644
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -24,6 +24,9 @@  LIBXL_LIBS = $(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl)
 ifeq ($(CONFIG_LIBNL),y)
 LIBXL_LIBS += $(LIBNL3_LIBS)
 endif
+ifeq ($(CONFIG_Linux),y)
+LIBXL_LIBS += -lrt
+endif
 
 CFLAGS_LIBXL += $(CFLAGS_libxentoollog)
 CFLAGS_LIBXL += $(CFLAGS_libxentoolcore)