mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jin Yao <yao.jin@linux.intel.com>
To: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
	mingo@redhat.com, alexander.shishkin@linux.intel.com
Cc: Linux-kernel@vger.kernel.org, ak@linux.intel.com,
	kan.liang@intel.com, yao.jin@intel.com,
	Jin Yao <yao.jin@linux.intel.com>
Subject: [PATCH] perf util: Display warning when perf report/annotate is missing some libs
Date: Thu, 11 Jan 2018 19:03:06 +0800	[thread overview]
Message-ID: <1515668586-14327-1-git-send-email-yao.jin@linux.intel.com> (raw)

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

             reply	other threads:[~2018-01-11  3:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11 11:03 Jin Yao [this message]
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

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=1515668586-14327-1-git-send-email-yao.jin@linux.intel.com \
    --to=yao.jin@linux.intel.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.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

Powered by JetHome