Bug 63166 - fails to build on Linux with recent glibc
Summary: fails to build on Linux with recent glibc
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Simon McVittie
QA Contact: Havoc Pennington
URL:
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2013-04-05 12:54 UTC by Simon McVittie
Modified: 2013-04-23 18:16 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
On Linux, check for mq_getattr(), needed by sd-daemon.c (1.03 KB, patch)
2013-04-05 12:54 UTC, Simon McVittie
Details | Splinter Review
Disable sd-daemon.c's support for POSIX message queues (979 bytes, patch)
2013-04-16 16:47 UTC, Simon McVittie
Details | Splinter Review

Description Simon McVittie 2013-04-05 12:54:26 UTC
Created attachment 77478 [details] [review]
On Linux, check for mq_getattr(), needed by sd-daemon.c

With recent glibc, we have no other reason to need -lrt, so we don't
link it and the build fails.

---
    
I'll open a separate bug against systemd - it ought to be possible to omit support for POSIX message queues and drop the -lrt dependency - but this is the best I can do without modifying sd-daemon.c.
Comment 1 Simon McVittie 2013-04-08 11:17:13 UTC
(In reply to comment #0)
> I'll open a separate bug against systemd

Bug #63167
Comment 2 Simon McVittie 2013-04-16 16:47:00 UTC
Created attachment 78100 [details] [review]
Disable sd-daemon.c's support for POSIX message queues

This fixes build failures with recent glibc while avoiding an
otherwise useless librt dependency.

---

Now that I've updated sd-daemon.[ch] from systemd git, we can avoid needing librt altogether.
Comment 3 Thiago Macieira 2013-04-22 16:53:53 UTC
Comment on attachment 78100 [details] [review]
Disable sd-daemon.c's support for POSIX message queues

Review of attachment 78100 [details] [review]:
-----------------------------------------------------------------

Shouldn't there be somewhere in the Makefile.am a link to -lrt?
Comment 4 Simon McVittie 2013-04-22 18:28:12 UTC
(In reply to comment #3)
> Shouldn't there be somewhere in the Makefile.am a link to -lrt?

Until recently, clock_getres() was in -lrt, so our checks in configure.ac meant that THREAD_LIBS ended up including it. However, glibc 2.17 made this change:

* The `clock_*' suite of functions (declared in <time.h>) is now available
  directly in the main C library.  Previously it was necessary to link with
  -lrt to use these functions.  This change has the effect that a
  single-threaded program that uses a function such as `clock_gettime' (and
  is not linked with -lrt) will no longer implicitly load the pthreads
  library at runtime and so will not suffer the overheads associated with
  multi-thread support in other code such as the C++ runtime library.

so we no longer linked -lrt in order to get clock_getres(). That meant we couldn't see the implementation of mq_getattr() either, and linking failed.

In attachment #77478 [details] [review] I added a check for the location of mq_getattr(), which is used by sd-daemon.c, so arguably we should have been checking for it ever since sd-daemon.c was used.

We don't really actually *want* -lrt or mq_getattr(), though - nothing in libdbus has ever cared about POSIX message queues - so I opened Bug #63167, requesting a way to stop sd-daemon.c from referencing mq_getattr(). Lennart applied my patch, and I've already updated libdbus' copy.

If you would prefer Attachment #77478 [details] for some reason, we could have that instead.
Comment 5 Thiago Macieira 2013-04-22 21:09:49 UTC
So you're saying that sd_daemon.c has dead code?

Then this patch is ok. Follow up later with another one removing the dead code.
Comment 6 Simon McVittie 2013-04-23 09:41:18 UTC
(In reply to comment #5)
> So you're saying that sd_daemon.c has dead code?

sd-daemon.c is imported verbatim from systemd. I don't think forking it is a valuable use of dbus maintainers' time.
Comment 7 Thiago Macieira 2013-04-23 15:59:12 UTC
I don't get why we need a verbatim copy of some file from a different project, but oh well. Patch is good.
Comment 8 Simon McVittie 2013-04-23 18:16:58 UTC
Fixed in git for 1.7.2, thanks.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.