trinity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: davej@codemonkey.org.uk
Cc: trinity@vger.kernel.org, Jiri Slaby <jslaby@suse.cz>
Subject: [PATCH v2 2/2] Makefile: fix build with older glibc
Date: Mon,  4 Jan 2016 12:21:31 +0100	[thread overview]
Message-ID: <1451906491-20710-2-git-send-email-jslaby@suse.cz> (raw)
In-Reply-To: <1451906491-20710-1-git-send-email-jslaby@suse.cz>

man 2 clock_gettime says:
Link with -lrt (only for glibc versions before 2.17).

If we do not do that, we get:
post-mortem.c:61: undefined reference to `clock_gettime'
syscall.o: In function `__do_syscall':
syscall.c:121: undefined reference to `clock_gettime'
watchdog.o: In function `is_child_making_progress':
watchdog.c:317: undefined reference to `clock_gettime'

So introduce (standard) LDLIBS into Makefile and add -lrt there.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 0cdcf4be0ae0..a70c5bd958a5 100644
--- a/Makefile
+++ b/Makefile
@@ -37,6 +37,9 @@ CFLAGS += -Wstrict-prototypes -Wmissing-prototypes
 # needed for show_backtrace() to work correctly.
 LDFLAGS += -rdynamic
 
+# glibc versions before 2.17 for clock_gettime
+LDLIBS += -lrt
+
 # gcc only.
 ifneq ($(shell $(CC) -v 2>&1 | grep -c "clang"), 1)
 CFLAGS += -Wlogical-op
@@ -96,7 +99,7 @@ DEPDIR= .deps
 -include $(SRCS:%.c=$(DEPDIR)/%.d)
 
 trinity: version test $(OBJS) $(HEADERS)
-	$(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o trinity $(OBJS)
+	$(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o trinity $(OBJS) $(LDLIBS)
 	@mkdir -p tmp
 
 df = $(DEPDIR)/$(*D)/$(*F)
-- 
2.6.4

      reply	other threads:[~2016-01-04 11:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04 11:21 [PATCH v2 1/2] compat.h: add more macros Jiri Slaby
2016-01-04 11:21 ` Jiri Slaby [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1451906491-20710-2-git-send-email-jslaby@suse.cz \
    --to=jslaby@suse.cz \
    --cc=davej@codemonkey.org.uk \
    --cc=trinity@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).