Bug 217291
Summary: | librt empty, man pages should not tell users to link with -lrt | ||
---|---|---|---|
Product: | Documentation | Reporter: | Janne Blomqvist (blomqvist.janne) |
Component: | man-pages | Assignee: | documentation_man-pages (documentation_man-pages) |
Status: | RESOLVED INVALID | ||
Severity: | low | CC: | alx, sam |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | Subsystem: | ||
Regression: | No | Bisected commit-id: |
Description
Janne Blomqvist
2023-04-03 08:23:16 UTC
It depends on one's libc (non-glibc implementations are free to need it still) rather than being obsolete altogether. Ultimately, a configure test is needed. (In reply to Sam James from comment #1) > It depends on one's libc (non-glibc implementations are free to need it > still) rather than being obsolete altogether. > > Ultimately, a configure test is needed. I'm not sure the man-pages project really concerns itself with non-glibc libc's. Of course you're right that a project that wants to be portable to multiple libc's will need configure tests (or equivalent). But that doesn't mean that a project that aims to document how to use glibc shouldn't tell users how to use it. My suggestion is that the man pages I mentioned above should have languages like clock_gettime and friends already have. That is, from https://www.man7.org/linux/man-pages/man3/clock_gettime.3.html : Link with -lrt (only for glibc versions before 2.17). Or in the current repo: .SH LIBRARY Standard C library .RI ( libc ", " \-lc ), since glibc 2.17 .PP Before glibc 2.17, Real-time library .RI ( librt ", " \-lrt ) (Not sure why one needs to explicitly tell to link with libc (-lc) and thus how this is an improvement over the older version published on the web page (and in most Linux distros man pages), but I digress) On 4/5/23 07:02, bugzilla-daemon@kernel.org wrote: > I'm not sure the man-pages project really concerns itself with non-glibc > libc's. It does. > Of course you're right that a project that wants to be portable to > multiple libc's will need configure tests (or equivalent). But that doesn't > mean that a project that aims to document how to use glibc shouldn't tell > users > how to use it. POSIX says that we should use -lrt, so I document that. If glibc makes it easier by putting everything in -lc, that's sugar for us, but unless the entire world follows glibc in that, or at least POSIX, I prefer to document POSIX. > > My suggestion is that the man pages I mentioned above should have languages > like clock_gettime and friends already have. That is, from > https://www.man7.org/linux/man-pages/man3/clock_gettime.3.html : I should rather fix clock_gettime(3) to show only what POSIX requires, which is -lrt. I just didn't find the time to compare all the pages with POSIX. What's the benefit of removing -lrt? > > Link with -lrt (only for glibc versions before 2.17). > > Or in the current repo: > > .SH LIBRARY > Standard C library > .RI ( libc ", " \-lc ), > since glibc 2.17 > .PP > Before glibc 2.17, > Real-time library > .RI ( librt ", " \-lrt ) > > (Not sure why one needs to explicitly tell to link with libc (-lc) and thus > how > this is an improvement over the older version published on the web page (and > in > most Linux distros man pages), but I digress) Consistency. If you see -lc, you know where it is. If you don't see it, then there are two options: either it is in libc, or the author forgot to document where it is. Also, while it's often unnecessary to specify -lc, it may in some corner cases be necessary, so I prefer specifying it. Thanks for reporting! However, I don't agree with the report :) |