Discussion:
[PATCH] make: link udevd with -lrt
Natanael Copa
2012-02-01 20:22:01 UTC
Permalink
sd-daemon.c uses mq_getattr() and should link with -lrt as the
man mq_getattr(3) states.

Signed-off-by: Natanael Copa <***@alpinelinux.org>
---
Makefile.am | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index e88a243..d5af409 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -249,7 +249,7 @@ src_udevd_SOURCES = \
src/sd-daemon.h \
src/sd-daemon.c
src_udevd_CFLAGS = $(udev_common_CFLAGS)
-src_udevd_LDADD = $(udev_common_LDADD)
+src_udevd_LDADD = $(udev_common_LDADD) -lrt
src_udevd_CPPFLAGS = $(udev_common_CPPFLAGS)

src_udevadm_SOURCES = \
--
1.7.9

--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Kay Sievers
2012-02-12 21:10:34 UTC
Permalink
Post by Natanael Copa
sd-daemon.c uses mq_getattr() and should link with -lrt as the
man mq_getattr(3) states.
Something seems wrong on your system. The:
AC_SEARCH_LIBS([clock_gettime], [rt], ...
in configure.ac should take care of that, and puts this in Makefile:
LIBS = -lrt
...
$(AM_V_CCLD)$(src_udevd_LINK) $(src_udevd_OBJECTS) $(src_udevd_LDADD) $(LIBS)

Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Natanael Copa
2012-02-14 08:45:44 UTC
Permalink
On Sun, 12 Feb 2012 22:10:34 +0100
Post by Kay Sievers
Post by Natanael Copa
sd-daemon.c uses mq_getattr() and should link with -lrt as the
man mq_getattr(3) states.
AC_SEARCH_LIBS([clock_gettime], [rt], ...
LIBS = -lrt
...
$(AM_V_CCLD)$(src_udevd_LINK) $(src_udevd_OBJECTS)
$(src_udevd_LDADD) $(LIBS)
Kay
configure:12437: checking for library containing clock_gettime
configure:12468: ccache gcc -o conftest -march=i486 -Os -fomit-frame-pointer -pipe -march=i486 -Os -fomit-frame-pointer -pipe -Wl,--as-needed conftest.c >&5
configure:12468: $? = 0
configure:12485: result: none required

$ nm -D /lib/libc.so.0.9.32 | grep clock_gettime
0000000000010b08 T clock_gettime
$ nm -D /lib/librt.so.0.9.32 | grep clock_gettime
00000000000023c0 T clock_gettime

So what is "wrong" on my system is that uClibc provides 2 different
versions of clock_gettime. One is with the threading additions and one
is without. This makes it possible to use clock_gettime() without
linking in the entire libpthread unless you actually use those
additions.

The configure script will test if -lrt is needed by checking
clock_gettime() and bumps into this "feature" and thinks it does not
need to add the -lrt flag. However, it also uses mq_getattr() which
does require -lrt.

We should probably check for mq_getattr() instead of clock_gettime().

Thanks!

-nc
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Natanael Copa
2012-02-14 09:20:12 UTC
Permalink
Some systems (like uClibc) has 2 versions of clock_gettime and will
use a lighter version when linked without -lrt. Therefore we test for
mq_getattr instead of clock_gettime.

Signed-off-by: Natanael Copa <***@alpinelinux.org>
---
configure.ac | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index a88a34c..382e9c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@ AC_PREFIX_DEFAULT([/usr])
AC_PATH_PROG([XSLTPROC], [xsltproc])
AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)

-AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([POSIX RT library not found])])
+AC_SEARCH_LIBS([mq_getattr], [rt], [], [AC_MSG_ERROR([POSIX RT library not found])])

PKG_CHECK_MODULES(BLKID, blkid >= 2.20)
--
1.7.9

--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Loading...