perf check: Allow showing a tip for opt-in features not built into perf
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 8 Apr 2025 13:56:30 +0000 (10:56 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 10 Apr 2025 13:44:42 +0000 (10:44 -0300)
commit31d7e6006312660fda19b03031dc4ee6f1bfeea9
tree0696b41028e16c8cd43839c92097d5687c67e577
parent0afeacbc8d0828140410ce144a60f6159a8e8437
perf check: Allow showing a tip for opt-in features not built into perf

Ingo reported that it was difficult to understand why libunwind support
didn't link even when he had the usual libunwind-dev files installed in
his machine.

This is because libunwind became opt-in, the user has to use
LIBUNWIND=1, as it was deemed stalled in its development/unsuitable for
use with perf, IIRC, and so we better use the elfutils equivalent
routine that we also supported for ages.

But the build message still printed:

  Auto-detecting system features:
  ...                                   libdw: [ on  ]
  ...                                   glibc: [ on  ]
  <SNIP>
  ...                               libcrypto: [ on  ]
  ...                               libunwind: [ OFF ]
  <SNIP>

Which is confusing, so allow for having a tip when 'perf version
--build-options' is used, and variants with 'perf check feature':

  $ perf version --build-options | grep libunwind
             libunwind: [ OFF ]  # HAVE_LIBUNWIND_SUPPORT ( tip: Deprecated, use LIBUNWIND=1 and install libunwind-dev[el] to build with it )
  $
  $ perf check feature libunwind
             libunwind: [ OFF ]  # HAVE_LIBUNWIND_SUPPORT ( tip: Deprecated, use LIBUNWIND=1 and install libunwind-dev[el] to build with it )
  $

The next patches will remove the opt-in libunwind FEATURES_DISPLAY.

Reported-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Ingo Molnar <mingo@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/Z--pWmTHGb62_83e@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-check.c
tools/perf/builtin.h