Skip to contentSkip to conversation

perf: Fix library detection when building without libelf

PATCH In review Patrick Palka 2 participants 4 messages Oct 24, 2013 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: Fix library detection when building without libelf

When I attempt to build perf on a system with slang but without libelf, 'make' would wrongly complain that the slang library could not be found.

It turns out that this was happening because we are not filtering -lelf from EXTLIBS early enough. As a result, the library test for slang (ditto for gtk, libaudit, etc) erroneously passes -lelf to try-cc, which of course fails on a system without libelf.

This patch makes the filtering of -lelf from EXTLIBS occur right after testing for libelf support, so that the subsequent library tests will not erroneously pass -lelf to try-cc when building without libelf support.

Cc Peter Zijlstra <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Jiri Olsa <[email protected]>
---
 tools/perf/Makefile        | 2 --
 tools/perf/config/Makefile | 4 ++++
 2 files changed, 4 insertions(+), 2 deletions(-)
tools/perf/Makefile +0 -2
index 64c043b..94635c8 100644
@@ -443,8 +443,6 @@ ifneq ($(OUTPUT),)
 endif
 
 ifdef NO_LIBELF
-EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
-
 # Remove ELF/DWARF dependent codes
 LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
 LIB_OBJS := $(filter-out $(OUTPUT)util/dwarf-aux.o,$(LIB_OBJS))
tools/perf/config/Makefile +4 -0
index 5f6f9b3..1748767 100644
@@ -174,6 +174,10 @@ else
 endif # SOURCE_LIBELF
 endif # NO_LIBELF
 
+ifdef NO_LIBELF
+EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
+endif
+
 ifndef NO_LIBELF
 CFLAGS += -DLIBELF_SUPPORT
 FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS)
Signature · 1 line
1.8.4.rc3
#1 lore raw

Em Wed, Oct 23, 2013 at 10:51:09PM -0400, Patrick Palka escreveu:

Quoted 8 lines

When I attempt to build perf on a system with slang but without libelf, 'make' would wrongly complain that the slang library could not be found.

It turns out that this was happening because we are not filtering -lelf from EXTLIBS early enough. As a result, the library test for slang (ditto for gtk, libaudit, etc) erroneously passes -lelf to try-cc, which of course fails on a system without libelf.

Quoted 4 lines

This patch makes the filtering of -lelf from EXTLIBS occur right after testing for libelf support, so that the subsequent library tests will not erroneously pass -lelf to try-cc when building without libelf support.

Can you please check with the perf/core branch in my tree or Ingo's?

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git perf/core

or Ingo's:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core

The feature detection was reworked and perhaps it is fixed there.

- Arnaldo

#2 lore raw
Quoted 18 lines · Arnaldo Carvalho de Melo

Em Wed, Oct 23, 2013 at 10:51:09PM -0400, Patrick Palka escreveu:

Quoted 8 lines

When I attempt to build perf on a system with slang but without libelf, 'make' would wrongly complain that the slang library could not be found.

It turns out that this was happening because we are not filtering -lelf from EXTLIBS early enough. As a result, the library test for slang (ditto for gtk, libaudit, etc) erroneously passes -lelf to try-cc, which of course fails on a system without libelf.

Quoted 4 lines

This patch makes the filtering of -lelf from EXTLIBS occur right after testing for libelf support, so that the subsequent library tests will not erroneously pass -lelf to try-cc when building without libelf support.

Can you please check with the perf/core branch in my tree or Ingo's?

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git perf/core

Quoted 7 lines

or Ingo's:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core

The feature detection was reworked and perhaps it is fixed there.

- Arnaldo

I can't reproduce the detection failure in your branch, and a quick inspection shows that the new feature-detection code is not subject to the kind of bug that my patch fixed. So consider my patch obsolete.

Thanks,
Patrick

#3 lore raw

Em Thu, Oct 24, 2013 at 04:36:47PM -0400, Patrick Palka escreveu:

Quoted 6 lines

On Thu, Oct 24, 2013 at 4:13 PM, Arnaldo Carvalho de Melo

Quoted 1 line

The feature detection was reworked and perhaps it is fixed there.

I can't reproduce the detection failure in your branch, and a quick inspection shows that the new feature-detection code is not subject to the kind of bug that my patch fixed. So consider my patch obsolete.

Thanks for checking!

- Arnaldo