public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@redhat.com>
To: Borislav Petkov <borislav.petkov@amd.com>
Cc: Ingo Molnar <mingo@elte.hu>, linux-kernel@vger.kernel.org
Subject: Re: perf and libdwarf on debian
Date: Wed, 16 Dec 2009 13:20:16 -0500	[thread overview]
Message-ID: <4B2924E0.9000301@redhat.com> (raw)
In-Reply-To: <20091216135448.GD11618@aftab>

Hi Borislav,

Borislav Petkov wrote:
> 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.

Thank you for reporting that :-)

> 
> 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...?

Yeah, I'd like to update Makefile rather than updating document...

> 
> ---
> 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

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,


-- 
Masami Hiramatsu

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

e-mail: mhiramat@redhat.com


  reply	other threads:[~2009-12-16 18:20 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 [this message]
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=4B2924E0.9000301@redhat.com \
    --to=mhiramat@redhat.com \
    --cc=borislav.petkov@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --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