All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf, tools: Support static linking with libdw
@ 2015-08-07 22:18 Andi Kleen
  2015-08-07 23:47 ` Arnaldo Carvalho de Melo
  2015-08-08 15:29 ` Jiri Olsa
  0 siblings, 2 replies; 6+ messages in thread
From: Andi Kleen @ 2015-08-07 22:18 UTC (permalink / raw)
  To: acme; +Cc: linux-kernel, jolsa, Andi Kleen

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

The Fedora 22 version of libdw requires a couple of extra libraries
to link. With a dynamic link the dependencies are pulled in automatically,
but this doesn't work for static linking. Add the needed libraries
explicitely to the feature probe and the Makefile.

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

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 463ed8f..179fc1a 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -70,7 +70,7 @@ test-glibc.bin:
 	$(BUILD)
 
 test-dwarf.bin:
-	$(BUILD) -ldw
+	$(BUILD) -ldw -lelf -lebl -lz -llzma -lbz2
 
 test-libelf-mmap.bin:
 	$(BUILD) -lelf
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 094ddae..384e0a6 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -297,7 +297,7 @@ ifndef NO_LIBELF
     else
       CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
       LDFLAGS += $(LIBDW_LDFLAGS)
-      EXTLIBS += -ldw
+      EXTLIBS += -ldw -lelf -lebl -lz -lbz2 -llzma
       $(call detected,CONFIG_DWARF)
     endif # PERF_HAVE_DWARF_REGS
   endif # NO_DWARF
-- 
2.4.3


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

* Re: [PATCH] perf, tools: Support static linking with libdw
  2015-08-07 22:18 [PATCH] perf, tools: Support static linking with libdw Andi Kleen
@ 2015-08-07 23:47 ` Arnaldo Carvalho de Melo
  2015-08-08 15:29 ` Jiri Olsa
  1 sibling, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-08-07 23:47 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel, jolsa, Andi Kleen

Em Fri, Aug 07, 2015 at 03:18:48PM -0700, Andi Kleen escreveu:
> From: Andi Kleen <ak@linux.intel.com>
> 
> The Fedora 22 version of libdw requires a couple of extra libraries
> to link. With a dynamic link the dependencies are pulled in automatically,
> but this doesn't work for static linking. Add the needed libraries
> explicitely to the feature probe and the Makefile.

Thanks, applied.

- Arnaldo

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

* Re: [PATCH] perf, tools: Support static linking with libdw
  2015-08-07 22:18 [PATCH] perf, tools: Support static linking with libdw Andi Kleen
  2015-08-07 23:47 ` Arnaldo Carvalho de Melo
@ 2015-08-08 15:29 ` Jiri Olsa
  2015-08-08 16:42   ` Andi Kleen
  1 sibling, 1 reply; 6+ messages in thread
From: Jiri Olsa @ 2015-08-08 15:29 UTC (permalink / raw)
  To: Andi Kleen; +Cc: acme, linux-kernel, Andi Kleen

On Fri, Aug 07, 2015 at 03:18:48PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> The Fedora 22 version of libdw requires a couple of extra libraries
> to link. With a dynamic link the dependencies are pulled in automatically,
> but this doesn't work for static linking. Add the needed libraries
> explicitely to the feature probe and the Makefile.
> 
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---
>  tools/build/feature/Makefile | 2 +-
>  tools/perf/config/Makefile   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 463ed8f..179fc1a 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -70,7 +70,7 @@ test-glibc.bin:
>  	$(BUILD)
>  
>  test-dwarf.bin:
> -	$(BUILD) -ldw
> +	$(BUILD) -ldw -lelf -lebl -lz -llzma -lbz2
>  
>  test-libelf-mmap.bin:
>  	$(BUILD) -lelf
> diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
> index 094ddae..384e0a6 100644
> --- a/tools/perf/config/Makefile
> +++ b/tools/perf/config/Makefile
> @@ -297,7 +297,7 @@ ifndef NO_LIBELF
>      else
>        CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
>        LDFLAGS += $(LIBDW_LDFLAGS)
> -      EXTLIBS += -ldw
> +      EXTLIBS += -ldw -lelf -lebl -lz -lbz2 -llzma
>        $(call detected,CONFIG_DWARF)
>      endif # PERF_HAVE_DWARF_REGS
>    endif # NO_DWARF
> -- 
> 2.4.3
> 

please also update the warning, as now it's not obvious you need
to install also bz2 libs (bzip2-devel on Fedora) for dwarf support..
we already have check for lzma

thanks,
jirka


[jolsa@krava perf]$ make 
  BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
...                         dwarf: [ OFF ]
...                         glibc: [ on  ]
...                          gtk2: [ on  ]
...                      libaudit: [ on  ]
...                        libbfd: [ on  ]
...                        libelf: [ on  ]
...                       libnuma: [ on  ]
...                       libperl: [ on  ]
...                     libpython: [ on  ]
...                      libslang: [ on  ]
...                     libunwind: [ on  ]
...            libdw-dwarf-unwind: [ on  ]
...                          zlib: [ on  ]
...                          lzma: [ on  ]

config/Makefile:267: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev


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

* Re: [PATCH] perf, tools: Support static linking with libdw
  2015-08-08 15:29 ` Jiri Olsa
@ 2015-08-08 16:42   ` Andi Kleen
  2015-08-10 14:57     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 6+ messages in thread
From: Andi Kleen @ 2015-08-08 16:42 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: Andi Kleen, acme, linux-kernel, Andi Kleen

> please also update the warning, as now it's not obvious you need
> to install also bz2 libs (bzip2-devel on Fedora) for dwarf support..
> we already have check for lzma

The package should already pull it in as a dependency.

-Andi

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

* Re: [PATCH] perf, tools: Support static linking with libdw
  2015-08-08 16:42   ` Andi Kleen
@ 2015-08-10 14:57     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-08-10 14:57 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Jiri Olsa, linux-kernel, Andi Kleen

Em Sat, Aug 08, 2015 at 06:42:19PM +0200, Andi Kleen escreveu:
> > please also update the warning, as now it's not obvious you need
> > to install also bz2 libs (bzip2-devel on Fedora) for dwarf support..
> > we already have check for lzma
> 
> The package should already pull it in as a dependency.

Noticed that this regresses my environment, Fedora 21:

  [acme@zoo linux]$ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf ; m
  make: Entering directory '/home/git/linux/tools/perf'
    BUILD:   Doing 'make -j4' parallel build

  Auto-detecting system features:
  ...                         dwarf: [ OFF ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ on  ]
  ...                      libaudit: [ on  ]
  ...                        libbfd: [ on  ]
  ...                        libelf: [ on  ]
  ...                       libnuma: [ on  ]
  ...                       libperl: [ on  ]
  ...                     libpython: [ on  ]
  ...                      libslang: [ on  ]
  ...                     libunwind: [ on  ]
  ...            libdw-dwarf-unwind: [ on  ]
  ...                          zlib: [ on  ]
  ...                          lzma: [ on  ]

  config/Makefile:267: No libdw.h found or old libdw.h found or elfutils
  is older than 0.138, disables dwarf support. Please install new
  elfutils-devel/libdw-dev
    MKDIR    /tmp/build/perf/util/

Have not investigated, just noticed that dwarf is disabled if this patch
is applied, removing it for now, will check later.

- Arnaldo

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

* [PATCH] perf, tools: Support static linking with libdw
@ 2015-08-12 22:48 Andi Kleen
  0 siblings, 0 replies; 6+ messages in thread
From: Andi Kleen @ 2015-08-12 22:48 UTC (permalink / raw)
  To: acme; +Cc: linux-kernel, jolsa, Andi Kleen

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

The Fedora 22 version of libdw requires a couple of extra libraries
to link. With a dynamic link the dependencies are pulled in automatically,
but this doesn't work for static linking. Add the needed libraries
explicitely to the feature probe and the Makefile.

v2: Explicitly check for static linking and only add the dependencies
when -static is set. This is to avoid regressions on Arnaldo's system.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 tools/build/feature/Makefile | 7 ++++++-
 tools/perf/config/Makefile   | 6 +++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 463ed8f..a8a5b7f 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -69,8 +69,13 @@ test-libelf.bin:
 test-glibc.bin:
 	$(BUILD)
 
+DWARFLIBS := -ldw
+ifeq ($(findstring -static,${LDFLAGS}),-static)
+DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
+endif
+
 test-dwarf.bin:
-	$(BUILD) -ldw
+	$(BUILD) $(DWARFLIBS)
 
 test-libelf-mmap.bin:
 	$(BUILD) -lelf
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 094ddae..e376a45 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -297,7 +297,11 @@ ifndef NO_LIBELF
     else
       CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
       LDFLAGS += $(LIBDW_LDFLAGS)
-      EXTLIBS += -ldw
+      DWARFLIBS := -ldw
+      ifeq ($(findstring -static,${LDFLAGS}),-static)
+	DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
+      endif
+      EXTLIBS += ${DWARFLIBS}
       $(call detected,CONFIG_DWARF)
     endif # PERF_HAVE_DWARF_REGS
   endif # NO_DWARF
-- 
2.4.3


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

end of thread, other threads:[~2015-08-12 22:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-07 22:18 [PATCH] perf, tools: Support static linking with libdw Andi Kleen
2015-08-07 23:47 ` Arnaldo Carvalho de Melo
2015-08-08 15:29 ` Jiri Olsa
2015-08-08 16:42   ` Andi Kleen
2015-08-10 14:57     ` Arnaldo Carvalho de Melo
2015-08-12 22:48 Andi Kleen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.