public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@redhat.com>
To: Borislav Petkov <petkovbb@googlemail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Borislav Petkov <borislav.petkov@amd.com>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org
Subject: Re: perf and libdwarf on debian
Date: Wed, 16 Dec 2009 17:29:02 -0500	[thread overview]
Message-ID: <4B295F2E.3060208@redhat.com> (raw)
In-Reply-To: <20091216221312.GC27228@liondog.tnic>

Borislav Petkov wrote:
> On Wed, Dec 16, 2009 at 08:19:15PM +0100, Peter Zijlstra wrote:
>> 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!!

> 
> --
> From: Borislav Petkov <petkovbb@gmail.com>
> 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.
> 
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Masami Hiramatsu <mhiramat@redhat.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
> ---
>  tools/perf/Makefile            |    4 ++--
>  tools/perf/util/probe-finder.h |    4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index 7814dbb..23ce10d 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -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
> diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
> index 5e4050c..adf7949 100644
> --- a/tools/perf/util/probe-finder.h
> +++ b/tools/perf/util/probe-finder.h
> @@ -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 */

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com


  reply	other threads:[~2009-12-16 22:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-16 13:54 perf and libdwarf on debian Borislav Petkov
2009-12-16 18:20 ` 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 [this message]
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=4B295F2E.3060208@redhat.com \
    --to=mhiramat@redhat.com \
    --cc=borislav.petkov@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=petkovbb@googlemail.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