public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf, tools: Add library dependencies for static perf link
@ 2012-09-29 18:13 Andi Kleen
  2012-09-29 18:52 ` Markus Trippelsdorf
  0 siblings, 1 reply; 4+ messages in thread
From: Andi Kleen @ 2012-09-29 18:13 UTC (permalink / raw)
  To: acme; +Cc: linux-kernel, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

When linking perf statically some of the library dependencies are always
rejected, so libdwarf and libbfd do not work.  The problem is that these
libraries (at least on my system) require other libraries. But unlike
a shared link the static link doesn't find those by itself, and they
have to be explicitely specified.

In my case I needed -ldl -lz for libbfd and -lslang for -lnewt

Add those to the probe statements.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 tools/perf/Makefile |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 35655c3..a79c702 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -491,7 +491,7 @@ endif # NO_DWARF
 ifdef NO_NEWT
 	BASIC_CFLAGS += -DNO_NEWT_SUPPORT
 else
-	FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt
+	FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt -lslang
 	ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y)
 		msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev);
 		BASIC_CFLAGS += -DNO_NEWT_SUPPORT
@@ -644,20 +644,20 @@ else
 		EXTLIBS += -liberty
 		BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
         else
-		FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd
+		FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -ldl
 		has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD))
 		ifeq ($(has_bfd),y)
-			EXTLIBS += -lbfd
+			EXTLIBS += -lbfd -ldl
 		else
-			FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty
+			FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty -ldl
 			has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY))
 			ifeq ($(has_bfd_iberty),y)
-				EXTLIBS += -lbfd -liberty
+				EXTLIBS += -lbfd -liberty -ldl
 			else
-				FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz
+				FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz -ldl
 				has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z))
 				ifeq ($(has_bfd_iberty_z),y)
-					EXTLIBS += -lbfd -liberty -lz
+					EXTLIBS += -lbfd -liberty -lz -ldl
 				else
 					FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty
 					has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE))
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf, tools: Add library dependencies for static perf link
  2012-09-29 18:13 [PATCH] perf, tools: Add library dependencies for static perf link Andi Kleen
@ 2012-09-29 18:52 ` Markus Trippelsdorf
  2012-10-01  1:07   ` Andi Kleen
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Trippelsdorf @ 2012-09-29 18:52 UTC (permalink / raw)
  To: Andi Kleen; +Cc: acme, linux-kernel, Andi Kleen

On 2012.09.29 at 11:13 -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> When linking perf statically some of the library dependencies are always
> rejected, so libdwarf and libbfd do not work.  The problem is that these
> libraries (at least on my system) require other libraries. But unlike
> a shared link the static link doesn't find those by itself, and they
> have to be explicitely specified.
> 
> In my case I needed -ldl -lz for libbfd and -lslang for -lnewt
> 
> Add those to the probe statements.

Just two little nitpicks.

> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---
>  tools/perf/Makefile |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index 35655c3..a79c702 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -491,7 +491,7 @@ endif # NO_DWARF
>  ifdef NO_NEWT
>  	BASIC_CFLAGS += -DNO_NEWT_SUPPORT
>  else
> -	FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt
> +	FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt -lslang
>  	ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT)),y)
>  		msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev);
>  		BASIC_CFLAGS += -DNO_NEWT_SUPPORT
> @@ -644,20 +644,20 @@ else
>  		EXTLIBS += -liberty
>  		BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
>          else
> -		FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd
> +		FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -ldl
>  		has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD))
>  		ifeq ($(has_bfd),y)
> -			EXTLIBS += -lbfd
> +			EXTLIBS += -lbfd -ldl
>  		else
> -			FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty
> +			FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty -ldl

This is superfluous, because FLAGS_BFD has -ldl already by your change
above. This is cascaded downwards.

>  			has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY))
>  			ifeq ($(has_bfd_iberty),y)
> -				EXTLIBS += -lbfd -liberty
> +				EXTLIBS += -lbfd -liberty -ldl
>  			else
> -				FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz
> +				FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz -ldl

Ditto.

>  				has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z))
>  				ifeq ($(has_bfd_iberty_z),y)
> -					EXTLIBS += -lbfd -liberty -lz
> +					EXTLIBS += -lbfd -liberty -lz -ldl
>  				else
>  					FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty
>  					has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE))

-- 
Markus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf, tools: Add library dependencies for static perf link
  2012-09-29 18:52 ` Markus Trippelsdorf
@ 2012-10-01  1:07   ` Andi Kleen
  2012-10-01 19:44     ` Andi Kleen
  0 siblings, 1 reply; 4+ messages in thread
From: Andi Kleen @ 2012-10-01  1:07 UTC (permalink / raw)
  To: Markus Trippelsdorf; +Cc: Andi Kleen, acme, linux-kernel

> This is superfluous, because FLAGS_BFD has -ldl already by your change
> above. This is cascaded downwards.

I tried to remove it, but that makes it not link again for the static build.
Haven't looked into the causes.

-Andi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf, tools: Add library dependencies for static perf link
  2012-10-01  1:07   ` Andi Kleen
@ 2012-10-01 19:44     ` Andi Kleen
  0 siblings, 0 replies; 4+ messages in thread
From: Andi Kleen @ 2012-10-01 19:44 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Markus Trippelsdorf, Andi Kleen, acme, linux-kernel

On Sun, Sep 30, 2012 at 06:07:09PM -0700, Andi Kleen wrote:
> > This is superfluous, because FLAGS_BFD has -ldl already by your change
> > above. This is cascaded downwards.
> 
> I tried to remove it, but that makes it not link again for the static build.
> Haven't looked into the causes.

Ok looking closer it seems like Fedora 16 does not have a static libbz2,
but libelf needs that.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-01 19:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-29 18:13 [PATCH] perf, tools: Add library dependencies for static perf link Andi Kleen
2012-09-29 18:52 ` Markus Trippelsdorf
2012-10-01  1:07   ` Andi Kleen
2012-10-01 19:44     ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox