linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf util: Display warning when perf report/annotate is missing some libs
@ 2018-01-11 11:03 Jin Yao
  2018-01-11 15:30 ` Jiri Olsa
  0 siblings, 1 reply; 17+ messages in thread
From: Jin Yao @ 2018-01-11 11:03 UTC (permalink / raw)
  To: acme, jolsa, peterz, mingo, alexander.shishkin
  Cc: Linux-kernel, ak, kan.liang, yao.jin, Jin Yao

We keep having bug reports that when users build perf on their own,
but they don't install some needed libraries like libelf, libbfd/libibery.

The perf can build, but it is missing important functionality.

For example, perf report doesn't display any symbols and perf annotate
doesn't work.

This patch displays warnings that these libraries are missing in build
when perf report / perf annotate are used.

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
---
 tools/perf/builtin-annotate.c |  2 ++
 tools/perf/builtin-report.c   |  2 ++
 tools/perf/util/symbol.c      | 21 +++++++++++++++++++++
 tools/perf/util/symbol.h      |  2 ++
 4 files changed, 27 insertions(+)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index f15731a..609eb7a 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -511,6 +511,8 @@ int cmd_annotate(int argc, const char **argv)
 
 	setup_browser(true);
 
+	build_lib_warning();
+
 	ret = __cmd_annotate(&annotate);
 
 out_delete:
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index dd4df9a..550adb7 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1293,6 +1293,8 @@ int cmd_report(int argc, const char **argv)
 		}
 	}
 
+	build_lib_warning();
+
 	if (symbol__init(&session->header.env) < 0)
 		goto error;
 
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index cc065d4..4205ba8 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -2224,3 +2224,24 @@ int symbol__config_symfs(const struct option *opt __maybe_unused,
 	free(bf);
 	return 0;
 }
+
+void build_lib_warning(void)
+{
+#ifndef HAVE_LIBELF_SUPPORT
+	pr_warning("Symbols are disabled!\n"
+		   "Please install libelf-dev, libelf-devel "
+		   "or elfutils-libelf-devel before building perf.\n");
+#endif
+
+#ifndef HAVE_DWARF_SUPPORT
+	pr_warning("Unwind support is disabled!\n"
+		   "Please install elfutils-devel/libdw-dev "
+		   "before building perf.\n");
+#endif
+
+#ifndef HAVE_LIBBFD_SUPPORT
+	pr_warning("C++ demangling and line numbers are disabled!\n"
+		   "Please install binutils-dev[el]/"
+		   "libiberty-dev before building perf.\n");
+#endif
+}
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 0563f33..d88e046 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -383,6 +383,8 @@ int get_sdt_note_list(struct list_head *head, const char *target);
 int cleanup_sdt_note_list(struct list_head *sdt_notes);
 int sdt_notes__get_count(struct list_head *start);
 
+void build_lib_warning(void);
+
 #define SDT_BASE_SCN ".stapsdt.base"
 #define SDT_NOTE_SCN  ".note.stapsdt"
 #define SDT_NOTE_TYPE 3
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2018-03-23 15:17 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-11 11:03 [PATCH] perf util: Display warning when perf report/annotate is missing some libs Jin Yao
2018-01-11 15:30 ` Jiri Olsa
2018-01-12  2:22   ` Jin, Yao
2018-03-21  2:11     ` Jin, Yao
2018-03-21 15:38       ` Jiri Olsa
2018-03-21 15:40         ` Arnaldo Carvalho de Melo
2018-03-21 15:43           ` Arnaldo Carvalho de Melo
2018-03-21 15:45             ` Arnaldo Carvalho de Melo
2018-03-21 16:04             ` Jiri Olsa
2018-03-21 18:52               ` Arnaldo Carvalho de Melo
2018-03-21 19:02                 ` Jiri Olsa
2018-03-22  1:31                 ` Jin, Yao
2018-03-22  1:04         ` Jin, Yao
2018-03-22  8:51           ` Jiri Olsa
2018-03-23  3:09             ` Jin, Yao
2018-03-23 14:50               ` Arnaldo Carvalho de Melo
2018-03-23 15:17                 ` Jiri Olsa

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 NNTP newsgroup(s).