Re: Build issues due to patch "gprofng: a new GNU profiler" – CLOCK_MONOTONIC_RAW not defined

Vladimir Mezentsev vladimir.mezentsev@oracle.com
Tue Mar 15 16:54:38 GMT 2022



On 3/15/22 08:24, Nick Clifton wrote:
> Hi Vladimir, Hi Tobias,
>
>   To save time I have gone ahead and applied a patch myself (attached).
>   Please let me know if I missed anything or made a mistake...
>
> Cheers
>   Nick


  Hi Nick,
I did not add -lrt for the gprofng/src build.


I suggested the following fix:

% diff --git a/gprofng/configure.ac b/gprofng/configure.ac
index 8977e8bd4bb..6522b6fab0e 100644
--- a/gprofng/configure.ac
+++ b/gprofng/configure.ac
@@ -35,8 +35,22 @@ GPROFNG_LIBADD="-L../../libiberty -liberty"
  if test "$enable_shared" = "yes"; then
    GPROFNG_LIBADD="-L../../libiberty/pic -liberty"
  fi
+
+# Check for the clock_gettime function.
+AC_CHECK_FUNCS(clock_gettime)
+clock_gettime_link=
+# At least for glibc, clock_gettime is in librt.  But don't
+# pull that in if it still doesn't give us the function we want.
+
+if test "$ac_cv_func_clock_gettime" = no; then
+  AC_CHECK_LIB(rt, clock_gettime,
+    [GPROFNG_LIBADD="$GPROFNG_LIBADD -lrt"
+     AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
+           [Define to 1 if you have the `clock_gettime' function.])])
+fi
  AC_SUBST(GPROFNG_LIBADD)

+
  # Figure out what compiler warnings we can enable.
  # See config/warnings.m4 for details.


Thank you,
-Vladimir



More information about the Binutils mailing list