From: Borislav Petkov <borislav.petkov@amd.com>
To: Ingo Molnar <mingo@elte.hu>, Masami Hiramatsu <mhiramat@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: perf and libdwarf on debian
Date: Wed, 16 Dec 2009 14:54:48 +0100 [thread overview]
Message-ID: <20091216135448.GD11618@aftab> (raw)
Hi,
even after installing libdwarf-dev on my debian box here, make in tools/perf/
still complains that it cannot find libdwarf:
Makefile:491: No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231
The problem is that the include path on debian is not
/usr/include/libdwarf/ but simply /usr/include because the debian
package libdwarf-dev puts the headers straight into /usr/include.
Now, fixing this in the build system could get ugly and too much (see
below), IMHO, so how about adding a README file in <tools/perf/>
which explains that on Debian-like systems, one should mkdir
/usr/include/libdwarf/ and symlink libdwarf.h and dwarf.h into it?
There could be a better solution though...?
---
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 4069996..5b48ce2 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -161,6 +161,7 @@ uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
+uname_D := $(shell sh -c "lsb_release -a 2>/dev/null | awk '/ID/ { print \$$3 }'")
# CFLAGS and LDFLAGS are for the users to override from the command line.
@@ -475,6 +476,14 @@ ifeq ($(uname_S),Darwin)
PTHREAD_LIBS =
endif
+ifeq ($(uname_D),Debian)
+ LIBDWARF_PREFIX =
+ BASIC_CFLAGS += -DDEBIAN
+else
+ LIBDWARF_PREFIX = libdwarf/
+endif
+
+
ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
@@ -487,7 +496,7 @@ else
msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
endif
-ifneq ($(shell sh -c "(echo '\#include <libdwarf/dwarf.h>'; echo '\#include <libdwarf/libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
+ifneq ($(shell sh -c "(echo '\#include <$(LIBDWARF_PREFIX)dwarf.h>'; echo '\#include <$(LIBDWARF_PREFIX)libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231);
BASIC_CFLAGS += -DNO_LIBDWARF
else
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index bdebca6..3be22f1 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -32,8 +32,13 @@ struct probe_point {
#ifndef NO_LIBDWARF
extern int find_probepoint(int fd, struct probe_point *pp);
+#ifndef DEBIAN
#include <libdwarf/dwarf.h>
#include <libdwarf/libdwarf.h>
+#else
+#include <dwarf.h>
+#include <libdwarf.h>
+#endif
struct probe_finder {
struct probe_point *pp; /* Target probe point */
--
Regards/Gruss,
Boris.
Operating | Advanced Micro Devices GmbH
System | Karl-Hammerschmidt-Str. 34, 85609 Dornach b. München, Germany
Research | Geschäftsführer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni
Center | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
(OSRC) | Registergericht München, HRB Nr. 43632
next reply other threads:[~2009-12-16 13:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-16 13:54 Borislav Petkov [this message]
2009-12-16 18:20 ` perf and libdwarf on debian Masami Hiramatsu
2009-12-16 18:32 ` Peter Zijlstra
2009-12-16 18:38 ` Gabor Gombas
2009-12-16 18:58 ` Peter Zijlstra
2009-12-16 22:31 ` Thomas Fjellstrom
2009-12-16 19:05 ` Masami Hiramatsu
2009-12-16 19:19 ` Peter Zijlstra
2009-12-16 22:13 ` Borislav Petkov
2009-12-16 22:29 ` Masami Hiramatsu
2009-12-16 18:49 ` Gabor Gombas
2009-12-16 22:16 ` [PATCH -tip] perf probe: Fix libdwarf include path Masami Hiramatsu
2009-12-17 7:54 ` [tip:perf/urgent] perf probe: Fix libdwarf include path for Debian tip-bot for Masami Hiramatsu
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=20091216135448.GD11618@aftab \
--to=borislav.petkov@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
/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