Re: [PATCH] Makefile: add NEEDS_LIBRT to optionally link with librt

3 messages, 3 authors, 2016-07-11 · open the first message on its own page

Re: [PATCH] Makefile: add NEEDS_LIBRT to optionally link with librt

From: Junio C Hamano <hidden>
Date: 2016-07-07 21:14:56

Ronald Wampler [off-list ref] writes:
I am not sure if this the correction solution. Another option I
considered was to wrap the EXTLIBS += -lrt is an ifndef NO_RT and only
defining NO_RT for Mac OS X in config.mak.uname.
That alternative would make the resulting code noisier/uglier with
nested ifdef, I would imagine, but it would be of less impact to the
existing users.  But my gut feeling is that the patch you sent is
probably a better solution for the longer term.

Thanks.

[PATCH] config.mak.uname: define NEEDS_LIBRT under Linux, for now

From: Eric Wong <hidden>
Date: 2016-07-10 22:16:49

Junio C Hamano [off-list ref] wrote:
Ronald Wampler [off-list ref] writes:
quoted
I am not sure if this the correction solution. Another option I
considered was to wrap the EXTLIBS += -lrt is an ifndef NO_RT and only
defining NO_RT for Mac OS X in config.mak.uname.
That alternative would make the resulting code noisier/uglier with
nested ifdef, I would imagine, but it would be of less impact to the
existing users.  But my gut feeling is that the patch you sent is
probably a better solution for the longer term.
That change broke my Debian wheezy LTS system, which isn't too
out-of-date.  I think having excessive linkage on newer systems
is preferable to breaking the out-of-the-box experience.

I don't know about other platforms, but I think the following
will help users on older GNU/Linux systems for the next few
years:

-------8<------
Subject: [PATCH] config.mak.uname: define NEEDS_LIBRT under Linux, for now

My Debian wheezy LTS system is still on glibc 2.13; and LTS
distros may use older glibc, still, so lets not unnecessarily
break things out-of-the-box.

We seem to assume Linux is using glibc in our Makefiles anyways,
so I don't think this will introduce new breakage for users of
alternative libc implementations.

Signed-off-by: Eric Wong <redacted>
---
 config.mak.uname | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/config.mak.uname b/config.mak.uname
index a88f139..22958a8 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -36,6 +36,8 @@ ifeq ($(uname_S),Linux)
 	HAVE_DEV_TTY = YesPlease
 	HAVE_CLOCK_GETTIME = YesPlease
 	HAVE_CLOCK_MONOTONIC = YesPlease
+	# -lrt is needed for clock_gettime on glibc <= 2.16
+	NEEDS_LIBRT = YesPlease
 	HAVE_GETDELIM = YesPlease
 	SANE_TEXT_GREP=-a
 endif
-- 
EW

Re: [PATCH] config.mak.uname: define NEEDS_LIBRT under Linux, for now

From: brian m. carlson <hidden>
Date: 2016-07-11 10:37:10

On Sun, Jul 10, 2016 at 10:16:44PM +0000, Eric Wong wrote:
My Debian wheezy LTS system is still on glibc 2.13; and LTS
distros may use older glibc, still, so lets not unnecessarily
break things out-of-the-box.

We seem to assume Linux is using glibc in our Makefiles anyways,
so I don't think this will introduce new breakage for users of
alternative libc implementations.
This is a good idea.  If it's broken with Debian wheezy, it will also be
broken for RHEL/CentOS 6.  People who really want the slimmest linkage
can use the -Wl,--as-needed flag.
-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | https://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: https://keybase.io/bk2204
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help