perf and libdwarf on debian
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...?
---
tools/perf/Makefile +10 -1
@@ -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
tools/perf/util/probe-finder.h +5 -0
@@ -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 */
Signature · 8 lines
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
Hi Borislav,
Quoted 10 lines · Borislav Petkov
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.hfound or oldlibdwarf.hfound, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231The problem is that the include path on debian is not
/usr/include/libdwarf/but simply/usr/includebecause the debian package libdwarf-dev puts the headers straight into/usr/include.
Thank you for reporting that :-)
Quoted 7 lines
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 symlinklibdwarf.handdwarf.hinto it?There could be a better solution though...?
Yeah, I'd like to update Makefile rather than updating document...
Quoted 15 lines
---
tools/perf/Makefile +1
-0@@ -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.
tools/perf/Makefile ifeq ($(uname_S),Darwin) · line 484
Quoted 9 lines
tools/perf/Makefile +6
-0@@ -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
Hmm, I think such Distro-checking code is ugly and very specific. Instead of that, it would be better to use -I option to search libdwarf.
e.g.
ifeq ($(shell sh -c "(test -d /usr/include/libdwarf/ && echo y)", y)
BASIC_CFLAGS += -I /usr/include/libdwarf
endif
And including just libdwarf.h and dwarf.h.
Thank you again,
Signature · 7 lines
Masami Hiramatsu Software Engineer Hitachi Computer Products (America), Inc. Software Solutions Division e-mail: [email protected]
Peter Zijlstra
maintainerQuoted 11 lines · Borislav Petkov
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.hfound or oldlibdwarf.hfound, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231The problem is that the include path on debian is not
/usr/include/libdwarf/but simply/usr/includebecause the debian package libdwarf-dev puts the headers straight into/usr/include.
Quoted 6 lines
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 symlinklibdwarf.handdwarf.hinto it?There could be a better solution though...?
Yeah, like file a bug with RH for placing them in such an utterly stupid location.
Also, I'd not bother with testing debian, just do
#include <dwarf.h>
and simply add -I/usr/include/libdwarf to CPPFLAGS or something like that.
Then again, its not like debian would ever ship something recent enough to actually build perf with, even my karmic machine comes with libdwarf-20080409 which to me reads like ancient and not befitting a distro released a month or so ago.
Quoted 4 lines · Peter Zijlstra
Then again, its not like debian would ever ship something recent enough to actually build perf with, even my karmic machine comes with libdwarf-20080409 which to me reads like ancient and not befitting a distro released a month or so ago.
"karmic" sounds Ubuntu, not Debian. In Debian:
$ apt-cache policy libdwarf-dev
libdwarf-dev:
Installed: (none)
Candidate: 20091012-1
Version table:
20091012-1 0
990 http://ftp.hu.debian.org sid/main Packages
500 http://ftp.hu.debian.org squeeze/main Packages
20080409-2 0
500 http://ftp.hu.debian.org lenny/main PackagesGabor
Signature · 4 lines
---------------------------------------------------------
MTA SZTAKI Computer and Automation Research Institute
Hungarian Academy of Sciences
---------------------------------------------------------Peter Zijlstra
maintainerQuoted 8 lines · Gabor Gombas
Quoted 4 lines · Peter Zijlstra
Then again, its not like debian would ever ship something recent enough to actually build perf with, even my karmic machine comes with libdwarf-20080409 which to me reads like ancient and not befitting a distro released a month or so ago.
"karmic" sounds Ubuntu, not Debian. In Debian:
And here I thought ubuntu was generally a less ancient debian..
Quoted 11 lines · Peter Zijlstra
Quoted 7 lines · Gabor Gombas
Quoted 4 lines · Peter Zijlstra
Then again, its not like debian would ever ship something recent enough to actually build perf with, even my karmic machine comes with libdwarf-20080409 which to me reads like ancient and not befitting a distro released a month or so ago.
"karmic" sounds Ubuntu, not Debian. In Debian:
And here I thought ubuntu was generally a less ancient debian..
Only at the moment they mirrored the Sid repo for the new release. After that things freeze.
Quoted 7 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel"
in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
Thomas Fjellstrom [email protected]
Quoted 22 lines · Peter Zijlstra
Quoted 11 lines · Borislav Petkov
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.hfound or oldlibdwarf.hfound, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231The problem is that the include path on debian is not
/usr/include/libdwarf/but simply/usr/includebecause the debian package libdwarf-dev puts the headers straight into/usr/include.Quoted 6 lines
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 symlinklibdwarf.handdwarf.hinto it?There could be a better solution though...?
Yeah, like file a bug with RH for placing them in such an utterly stupid location.
Quoted 6 lines
Also, I'd not bother with testing debian, just do
#include <
dwarf.h>and simply add -I/usr/include/libdwarf to CPPFLAGS or something like that.
Ah, right, I was stupid!
Quoted 5 lines · Masami Hiramatsu
e.g.
ifeq ($(shell sh -c "(test -d
/usr/include/libdwarf/&& echo y)", y)BASIC_CFLAGS += -I /usr/include/libdwarfendif
So, it just need;
BASIC_CFLAGS += -I/usr/include/libdwarf
And including just libdwarf.h and dwarf.h.
Thank you,
Signature · 7 lines
Masami Hiramatsu Software Engineer Hitachi Computer Products (America), Inc. Software Solutions Division e-mail: [email protected]
Peter Zijlstra
maintainerQuoted 12 lines · Masami Hiramatsu
Quoted 2 lines
and simply add -I/usr/include/libdwarf to CPPFLAGS or something like that.
Ah, right, I was stupid!
Quoted 5 lines · Masami Hiramatsu
e.g.
ifeq ($(shell sh -c "(test -d
/usr/include/libdwarf/&& echo y)", y)BASIC_CFLAGS += -I /usr/include/libdwarfendif
Quoted 5 lines
So, it just need;
BASIC_CFLAGS+= -I/usr/include/libdwarfAnd including just
libdwarf.handdwarf.h.
Well, I'm not 100% sure -I/foo will actually work if foo doesn't exist, but I'd sure try it first since its less typing :-)
If it doesn't your suggestion is a good alternative.
Quoted 2 lines · Peter Zijlstra
Well, I'm not 100% sure -I/foo will actually work if foo doesn't exist, but I'd sure try it first since its less typing :-)
Yes, it does :) Here's a much simpler fix:
--
From: Borislav Petkov <[email protected]>
Date: Wed, 16 Dec 2009 23:07:10 +0100
Subject: [PATCH] perf: fix libdwarf include paths
even after installing libdwarf-dev on debian 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 libdwarf headers on debian are not placed in /usr/include/libdwarf/ but simply in /usr/include.
Fix by adding the non-standard path to BASIC_CFLAGS and truncating the include directives.
--- tools/perf/Makefile | 4 ++-- tools/perf/util/probe-finder.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
tools/perf/Makefile +2 -2
@@ -260,7 +260,7 @@ endif # Those must not be GNU-specific; they are shared with perl/ which may # be built by a different compiler. (Note that this is an artifact now # but it still might be nice to keep that distinction.) -BASIC_CFLAGS = -Iutil/include +BASIC_CFLAGS = -Iutil/include -I/usr/include/libdwarf BASIC_LDFLAGS = # Guard against environment variables
@@ -487,7 +487,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 <dwarf.h>'; echo '\#include <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
tools/perf/util/probe-finder.h +2 -2
@@ -35,8 +35,8 @@ struct probe_point { #ifndef NO_LIBDWARF extern int find_probepoint(int fd, struct probe_point *pp); -#include <libdwarf/dwarf.h> -#include <libdwarf/libdwarf.h> +#include <dwarf.h> +#include <libdwarf.h> struct probe_finder { struct probe_point *pp; /* Target probe point */
Signature · 6 lines
1.6.5
--
Regards/Gruss,
Boris.Quoted 5 lines · Borislav Petkov
Quoted 2 lines · Peter Zijlstra
Well, I'm not 100% sure -I/foo will actually work if foo doesn't exist, but I'd sure try it first since its less typing :-)
Yes, it does :) Here's a much simpler fix:
Oops, I also posted another version X(
Actually, from unknown reason, #include <libdwarf.h> causes "_MIPS_SZLONG is not defined" error on my Fedora11 (curiously, even #include <libdwarf/libdwarf.h> didn't cause the bug!).
So I added a workaround for the bug on my patch.
Anyway, Thank you very much for reporting the bug and making a fix!!
Quoted 63 lines
--
From: Borislav Petkov <[email protected]>
Date: Wed, 16 Dec 2009 23:07:10 +0100
Subject: [PATCH] perf: fix libdwarf include pathseven after installing libdwarf-dev on debian make in
tools/perf/still complains that it cannot find libdwarf:Makefile:491: No
libdwarf.hfound or oldlibdwarf.hfound, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231The problem is that the libdwarf headers on debian are not placed in
/usr/include/libdwarf/but simply in/usr/include.Fix by adding the non-standard path to
BASIC_CFLAGSand truncating the include directives.Cc Peter Zijlstra <[email protected]>Cc Masami Hiramatsu <[email protected]>Cc Ingo Molnar <[email protected]>Signed-off-by Borislav Petkov <[email protected]>--- tools/perf/Makefile | 4 ++-- tools/perf/util/probe-finder.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)tools/perf/Makefile +2
-2@@ -260,7 +260,7 @@ endif # Those must not be GNU-specific; they are shared with perl/ which may # be built by a different compiler. (Note that this is an artifact now # but it still might be nice to keep that distinction.) -BASIC_CFLAGS = -Iutil/include +BASIC_CFLAGS = -Iutil/include -I/usr/include/libdwarf BASIC_LDFLAGS = # Guard against environment variables@@ -487,7 +487,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 <dwarf.h>'; echo '\#include <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 elsetools/perf/util/probe-finder.h +2
-2@@ -35,8 +35,8 @@ struct probe_point { #ifndef NO_LIBDWARF extern int find_probepoint(int fd, struct probe_point *pp); -#include <libdwarf/dwarf.h> -#include <libdwarf/libdwarf.h> +#include <dwarf.h> +#include <libdwarf.h> struct probe_finder { struct probe_point *pp; /* Target probe point */
Signature · 7 lines
Masami Hiramatsu Software Engineer Hitachi Computer Products (America), Inc. Software Solutions Division e-mail: [email protected]
Quoted 6 lines · Borislav Petkov
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 symlinklibdwarf.handdwarf.hinto it?There could be a better solution though...?
Bug the libdwarf developers to ship a .pc file for pkg-config that distros can customize as needed.
Gabor
Signature · 4 lines
---------------------------------------------------------
MTA SZTAKI Computer and Automation Research Institute
Hungarian Academy of Sciences
---------------------------------------------------------PATCH 1/1 perf probe: Fix libdwarf include path
In reply to Borislav PetkovFix libdwarf include path to fit debian-like systems too.
Quoted 10 lines · Borislav Petkov
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.hfound or oldlibdwarf.hfound, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231The problem is that the include path on debian is not
/usr/include/libdwarf/but simply/usr/includebecause the debian package libdwarf-dev puts the headers straight into/usr/include.
This patch adds -I/usr/include/libdwarf to BASIC_CFLAGS and fix probe-finder.h to include just libdwarf.h/dwarf.h.
This patch also add a workaround for undefined _MIPS_SZLONG bug in libdwarf.h.
---
tools/perf/Makefile | 3 ++- tools/perf/util/probe-finder.h | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-)
tools/perf/Makefile +2 -1
@@ -487,10 +487,11 @@ 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 '\#ifndef _MIPS_SZLONG'; echo '\#define _MIPS_SZLONG 0'; echo '\#endif'; echo '\#include <dwarf.h>'; echo '\#include <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 -I/usr/include/libdwarf -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 + BASIC_CFLAGS += -I/usr/include/libdwarf EXTLIBS += -lelf -ldwarf LIB_OBJS += util/probe-finder.o endif
tools/perf/util/probe-finder.h +7 -2
@@ -35,8 +35,13 @@ struct probe_point { #ifndef NO_LIBDWARF extern int find_probepoint(int fd, struct probe_point *pp); -#include <libdwarf/dwarf.h> -#include <libdwarf/libdwarf.h> +/* Workaround for undefined _MIPS_SZLONG bug in libdwarf.h */ +#ifndef _MIPS_SZLONG +#define _MIPS_SZLONG 0 +#endif + +#include <dwarf.h> +#include <libdwarf.h> struct probe_finder { struct probe_point *pp; /* Target probe point */
Signature · 7 lines
Masami Hiramatsu Software Engineer Hitachi Computer Products (America), Inc. Software Solutions Division e-mail: [email protected]
[tip:perf/urgent] perf probe: Fix libdwarf include path for Debian
Commit-ID: 27f3b24de03fc7cec6f2406f8525ad18086c2121 Gitweb: http://git.kernel.org/tip/27f3b24de03fc7cec6f2406f8525ad18086c2121 Author: Masami Hiramatsu <[email protected]> AuthorDate: Wed, 16 Dec 2009 17:16:19 -0500 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 17 Dec 2009 08:06:41 +0100
perf probe: Fix libdwarf include path for Debian
Fix libdwarf include path to fit debian-like systems too.
Borislav Petkov reported:
Quoted 10 lines
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.hfound or oldlibdwarf.hfound, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231The problem is that the include path on debian is not
/usr/include/libdwarf/but simply/usr/includebecause the debian package libdwarf-dev puts the headers straight into/usr/include.
This patch adds -I/usr/include/libdwarf to BASIC_CFLAGS and fix probe-finder.h to include just libdwarf.h/dwarf.h.
This patch also adds a workaround for the undefined _MIPS_SZLONG bug in libdwarf.h.
LKML-Reference: <[email protected]>
--- tools/perf/Makefile | 3 +- tools/perf/util/probe-finder.h | 59 +++++++++++++++++++++------------------ 2 files changed, 34 insertions(+), 28 deletions(-)
tools/perf/Makefile +2 -1
@@ -487,10 +487,11 @@ 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 '\#ifndef _MIPS_SZLONG'; echo '\#define _MIPS_SZLONG 0'; echo '\#endif'; echo '\#include <dwarf.h>'; echo '\#include <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 -I/usr/include/libdwarf -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 + BASIC_CFLAGS += -I/usr/include/libdwarf EXTLIBS += -lelf -ldwarf LIB_OBJS += util/probe-finder.o endif
tools/perf/util/probe-finder.h +32 -27
89 lines not on this page · raw message