From: Tobias Burnus <tobias@codesourcery.com>
To: Binutils <binutils@sourceware.org>,
Vladimir Mezentsev <vladimir.mezentsev@oracle.com>,
Nick Clifton <nickc@redhat.com>
Subject: Build issues due to patch "gprofng: a new GNU profiler" – CLOCK_MONOTONIC_RAW not defined
Date: Mon, 14 Mar 2022 11:57:15 +0100 [thread overview]
Message-ID: <b4a7ff3d-c65e-5094-6e94-d1491b2b95c1@codesourcery.com> (raw)
Hi Vladimir, hi Nick,
Friday's commit "gprofng: a new GNU profiler",
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=bb368aad297fe3ad40cf397e6fc85aa471429a28
broke the build here (build server using on purpose an older Linux/glibc):
gprofng/libcollector/gethrtime.c:35:26: error: 'CLOCK_MONOTONIC_RAW' undeclared (first use in this function); did you mean 'CLOCK_MONOTONIC'?
int r = clock_gettime (CLOCK_MONOTONIC_RAW, &tp);
^~~~~~~~~~~~~~~~~~~
CLOCK_MONOTONIC
According to https://linux.die.net/man/2/clock_gettime:
CLOCK_MONOTONIC_RAW (since Linux 2.6.28; Linux-specific)
Similar to CLOCK_MONOTONIC, but provides access to a raw hardware-based
time that is not subject to NTP adjustments or the incremental
adjustments performed by adjtime(3).
Thus, it seems as if either a config check or a much
simpler patch as the following is needed:
--- a/gprofng/libcollector/gethrtime.c
+++ b/gprofng/libcollector/gethrtime.c
@@ -34,3 +34,7 @@ linux_gethrtime ()
hrtime_t rc = 0;
+#ifdef CLOCK_MONOTONIC_RAW
int r = clock_gettime (CLOCK_MONOTONIC_RAW, &tp);
+#else
+ int r = clock_gettime (CLOCK_MONOTONIC, &tp);
+#endif
if (r == 0)
--- a/gprofng/src/gethrtime.c
+++ b/gprofng/src/gethrtime.c
@@ -161,3 +161,7 @@ gethrtime (void)
*/
+#ifdef CLOCK_MONOTONIC_RAW
int r = clock_gettime (CLOCK_MONOTONIC_RAW, &tp);
+#else
+ int r = clock_gettime (CLOCK_MONOTONIC, &tp);
+#endif
if (r == 0)
* * *
Additionally, the build fails with the link error:
gprofng/src/gethrtime.c:131: undefined reference to `clock_gettime'
The problem seems to be what the 'clock_gettime(3)' man page states:
Link with -lrt (only for glibc versions before 2.17).
Please consider as fix to copy the following check from libbacktrace/configure.ac:
# Check for the clock_gettime function.
AC_CHECK_FUNCS(clock_gettime)
...
AC_SUBST(CLOCK_GETTIME_LINK)
Thanks,
Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
next reply other threads:[~2022-03-14 10:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-14 10:57 Tobias Burnus [this message]
2022-03-14 18:16 ` Vladimir Mezentsev
2022-03-15 15:24 ` Nick Clifton
2022-03-15 16:24 ` Tobias Burnus
2022-03-16 12:29 ` Nick Clifton
2022-03-16 14:55 ` Tobias Burnus
2022-03-18 15:25 ` Tobias Burnus
2022-03-18 15:47 ` Nick Clifton
2022-03-15 16:54 ` Vladimir Mezentsev
2022-03-15 16:59 ` Vladimir Mezentsev
2022-03-16 7:56 ` Tobias Burnus
2022-03-14 20:53 ` Joseph Myers
2022-03-14 21:52 ` Vladimir Mezentsev
2022-03-16 11:30 ` Nick Alcock
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=b4a7ff3d-c65e-5094-6e94-d1491b2b95c1@codesourcery.com \
--to=tobias@codesourcery.com \
--cc=binutils@sourceware.org \
--cc=nickc@redhat.com \
--cc=vladimir.mezentsev@oracle.com \
/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).