Skip to contentSkip to conversation

perf tools: Fix bfd dependency libraries detection

PATCH In review Jiri Olsa 5 participants 7 messages Apr 28, 2014 – May 1, 2014 perf events

lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

PATCH 1/1 perf tools: Fix bfd dependency libraries detection

From: Jiri Olsa <[email protected]>

There's false assumption in the library detection code assuming -liberty and -lz are always present once bfd is detected. The fails on Ubuntu (14.04) as reported by Ingo.

Forcing the bdf dependency libraries detection any time bfd library is detected.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/perf/config/Makefile | 34 +++++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)
tools/perf/config/Makefile +23 -11
index a71fb39..a57d59e 100644
@@ -194,7 +194,10 @@ VF_FEATURE_TESTS =			\
 	stackprotector-all		\
 	timerfd				\
 	libunwind-debug-frame		\
-	bionic
+	bionic				\
+	liberty				\
+	liberty-z			\
+	cplus-demangle
 
 # Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features.
 # If in the future we need per-feature checks/flags for features not
@@ -512,7 +515,21 @@ else
 endif
 
 ifeq ($(feature-libbfd), 1)
-  EXTLIBS += -lbfd -lz -liberty
+  EXTLIBS += -lbfd
+
+  # call all detections now so we get correct
+  # status in VF output
+  $(call feature_check,liberty)
+  $(call feature_check,liberty-z)
+  $(call feature_check,cplus-demangle)
+
+  ifeq ($(feature-liberty), 1)
+    EXTLIBS += -liberty
+  else
+    ifeq ($(feature-liberty-z), 1)
+      EXTLIBS += -liberty -lz
+    endif
+  endif
 endif
 
 ifdef NO_DEMANGLE
@@ -523,15 +540,10 @@ else
     CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
   else
     ifneq ($(feature-libbfd), 1)
-      $(call feature_check,liberty)
-      ifeq ($(feature-liberty), 1)
-        EXTLIBS += -lbfd -liberty
-      else
-        $(call feature_check,liberty-z)
-        ifeq ($(feature-liberty-z), 1)
-          EXTLIBS += -lbfd -liberty -lz
-        else
-          $(call feature_check,cplus-demangle)
+      ifneq ($(feature-liberty), 1)
+        ifneq ($(feature-liberty-z), 1)
+          # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
+          # or any of 'bfd iberty z' trinity
           ifeq ($(feature-cplus-demangle), 1)
             EXTLIBS += -liberty
             CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 9 lines · Jiri Olsa

From: Jiri Olsa <[email protected]>

There's false assumption in the library detection code assuming -liberty and -lz are always present once bfd is detected. The fails on Ubuntu (14.04) as reported by Ingo.

Forcing the bdf dependency libraries detection any time bfd library is detected.

Have you tried static builds? I need to do those occasionally and I always have to muck around with the Makefiles to get it to succeed -- something with the -liberty and bfd checks.

Quoted 33 lines
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
  tools/perf/config/Makefile | 34 +++++++++++++++++++++++-----------
  1 file changed, 23 insertions(+), 11 deletions(-)
tools/perf/config/Makefile +4 -1
index a71fb39..a57d59e 100644
@@ -194,7 +194,10 @@ VF_FEATURE_TESTS =			\
  	stackprotector-all		\
  	timerfd				\
  	libunwind-debug-frame		\
-	bionic
+	bionic				\
+	liberty				\
+	liberty-z			\
+	cplus-demangle
 
  # Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features.
  # If in the future we need per-feature checks/flags for features not

tools/perf/config/Makefile else · line 521

Quoted 8 lines
tools/perf/config/Makefile +4 -1
@@ -512,7 +515,21 @@ else
  endif
 
  ifeq ($(feature-libbfd), 1)
-  EXTLIBS += -lbfd -lz -liberty
+  EXTLIBS += -lbfd
+
+  # call all detections now so we get correct
+  # status in VF output

Are you folding the "VF" into V?

David

#2 lore raw
Quoted 8 lines · David Ahern
Quoted 7 lines · Jiri Olsa

From: Jiri Olsa <[email protected]>

There's false assumption in the library detection code assuming -liberty and -lz are always present once bfd is detected. The fails on Ubuntu (14.04) as reported by Ingo.

Quoted 6 lines
Quoted 2 lines

Forcing the bdf dependency libraries detection any time bfd library is detected.

Have you tried static builds? I need to do those occasionally and I always have to muck around with the Makefiles to get it to succeed -- something with the -liberty and bfd checks.

hm, I just tried and even without of the fix I wasn't able to do static build.. so far I ended up with:

---

  $ make LDFLAGS=-static NO_LIBUNWIND=1 NO_GTK2=1 JOBS=1
  ...

SUBDIR /home/jolsa/kernel.org/linux-perf/tools/lib/traceevent/
LINK perf
/bin/ld: cannot find -lelf
/home/jolsa/kernel.org/linux-perf/tools/lib/traceevent/libtraceevent.a(event-plugin.o): In function `load_plugin':
/home/jolsa/kernel.org/linux-perf/tools/lib/traceevent/event-plugin.c:60: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /bin/ld: cannot find -lelf
/bin/ld: cannot find -ldw
/bin/ld: cannot find -laudit
/bin/ld: cannot find -lslang
/bin/ld: cannot find -lperl
libperf.a(target.o): In function `target__parse_uid':
/home/jolsa/kernel.org/linux-perf/tools/perf/util/target.c:79: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /home/jolsa/kernel.org/linux-perf/tools/perf/util/target.c:91: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/libpthread.a(libpthread.o): In function `sem_open':
(.text+0x67eb): warning: the use of mktemp' is dangerous, better use mkstemp'
/bin/ld: cannot find -lpython2.7
/bin/ld: cannot find -lz
/bin/ld: cannot find -lnuma
collect2: error: ld returned 1 exit status
make[1]: *** [perf] Error 1
make: *** [all] Error 2
---

Any hints what you did to make it pass?
Let's fix it and put test for this in tests/make suite ;-)

thanks,
jirka

#3 lore raw
Quoted 46 lines · Jiri Olsa
Quoted 8 lines · David Ahern
Quoted 7 lines · Jiri Olsa

From: Jiri Olsa <[email protected]>

There's false assumption in the library detection code assuming -liberty and -lz are always present once bfd is detected. The fails on Ubuntu (14.04) as reported by Ingo.

Quoted 6 lines
Quoted 2 lines

Forcing the bdf dependency libraries detection any time bfd library is detected.

Have you tried static builds? I need to do those occasionally and I always have to muck around with the Makefiles to get it to succeed -- something with the -liberty and bfd checks.

hm, I just tried and even without of the fix I wasn't able to do static build.. so far I ended up with:

---

   $ make LDFLAGS=-static NO_LIBUNWIND=1 NO_GTK2=1 JOBS=1
   ...

SUBDIR /home/jolsa/kernel.org/linux-perf/tools/lib/traceevent/
LINK perf
/bin/ld: cannot find -lelf
/home/jolsa/kernel.org/linux-perf/tools/lib/traceevent/libtraceevent.a(event-plugin.o): In function `load_plugin':
/home/jolsa/kernel.org/linux-perf/tools/lib/traceevent/event-plugin.c:60: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /bin/ld: cannot find -lelf
/bin/ld: cannot find -ldw
/bin/ld: cannot find -laudit
/bin/ld: cannot find -lslang
/bin/ld: cannot find -lperl
libperf.a(target.o): In function `target__parse_uid':
/home/jolsa/kernel.org/linux-perf/tools/perf/util/target.c:79: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /home/jolsa/kernel.org/linux-perf/tools/perf/util/target.c:91: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/libpthread.a(libpthread.o): In function `sem_open':
(.text+0x67eb): warning: the use of mktemp' is dangerous, better use mkstemp'
/bin/ld: cannot find -lpython2.7
/bin/ld: cannot find -lz
/bin/ld: cannot find -lnuma
collect2: error: ld returned 1 exit status
make[1]: *** [perf] Error 1
make: *** [all] Error 2
---

Quoted 2 lines

Any hints what you did to make it pass?
Let's fix it and put test for this in tests/make suite ;-)

# rpm -qa | grep static
glibc-static-2.14.90-24.fc16.9.x86_64
audit-libs-static-2.2.1-1.fc16.x86_64
elfutils-libelf-devel-static-0.154-2.fc16.x86_64
zlib-static-1.2.5-7.fc16.x86_64
# make O=/tmp/junk LDFLAGS=-static

David

#4 lore raw
Quoted 50 lines · David Ahern
Quoted 46 lines · Jiri Olsa
Quoted 8 lines · David Ahern
Quoted 7 lines · Jiri Olsa

From: Jiri Olsa <[email protected]>

There's false assumption in the library detection code assuming -liberty and -lz are always present once bfd is detected. The fails on Ubuntu (14.04) as reported by Ingo.

Quoted 6 lines
Quoted 2 lines

Forcing the bdf dependency libraries detection any time bfd library is detected.

Have you tried static builds? I need to do those occasionally and I always have to muck around with the Makefiles to get it to succeed -- something with the -liberty and bfd checks.

hm, I just tried and even without of the fix I wasn't able to do static build.. so far I ended up with:

---

  $ make LDFLAGS=-static NO_LIBUNWIND=1 NO_GTK2=1 JOBS=1
  ...

SUBDIR /home/jolsa/kernel.org/linux-perf/tools/lib/traceevent/
LINK perf
/bin/ld: cannot find -lelf
/home/jolsa/kernel.org/linux-perf/tools/lib/traceevent/libtraceevent.a(event-plugin.o): In function `load_plugin':
/home/jolsa/kernel.org/linux-perf/tools/lib/traceevent/event-plugin.c:60: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /bin/ld: cannot find -lelf
/bin/ld: cannot find -ldw
/bin/ld: cannot find -laudit
/bin/ld: cannot find -lslang
/bin/ld: cannot find -lperl
libperf.a(target.o): In function `target__parse_uid':
/home/jolsa/kernel.org/linux-perf/tools/perf/util/target.c:79: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /home/jolsa/kernel.org/linux-perf/tools/perf/util/target.c:91: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/libpthread.a(libpthread.o): In function `sem_open':
(.text+0x67eb): warning: the use of mktemp' is dangerous, better use mkstemp'
/bin/ld: cannot find -lpython2.7
/bin/ld: cannot find -lz
/bin/ld: cannot find -lnuma
collect2: error: ld returned 1 exit status
make[1]: *** [perf] Error 1
make: *** [all] Error 2
---

Quoted 2 lines

Any hints what you did to make it pass?
Let's fix it and put test for this in tests/make suite ;-)

Quoted 7 lines
# rpm -qa | grep static
glibc-static-2.14.90-24.fc16.9.x86_64
audit-libs-static-2.2.1-1.fc16.x86_64
elfutils-libelf-devel-static-0.154-2.fc16.x86_64
zlib-static-1.2.5-7.fc16.x86_64
# make O=/tmp/junk LDFLAGS=-static

hum.. I must have some bad tree state ;-) I can do it now jsut with:

  $ make LDFLAGS=-static

only with glibc-static package

thanks,
jirka

#5 lore raw
In reply to Jiri Olsa
Quoted 46 lines · Jiri Olsa
Quoted 8 lines · David Ahern
Quoted 7 lines · Jiri Olsa

From: Jiri Olsa <[email protected]>

There's false assumption in the library detection code assuming -liberty and -lz are always present once bfd is detected. The fails on Ubuntu (14.04) as reported by Ingo.

Quoted 6 lines
Quoted 2 lines

Forcing the bdf dependency libraries detection any time bfd library is detected.

Have you tried static builds? I need to do those occasionally and I always have to muck around with the Makefiles to get it to succeed -- something with the -liberty and bfd checks.

hm, I just tried and even without of the fix I wasn't able to do static build.. so far I ended up with:

---

  $ make LDFLAGS=-static NO_LIBUNWIND=1 NO_GTK2=1 JOBS=1
  ...

SUBDIR /home/jolsa/kernel.org/linux-perf/tools/lib/traceevent/
LINK perf
/bin/ld: cannot find -lelf
/home/jolsa/kernel.org/linux-perf/tools/lib/traceevent/libtraceevent.a(event-plugin.o): In function `load_plugin':
/home/jolsa/kernel.org/linux-perf/tools/lib/traceevent/event-plugin.c:60: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /bin/ld: cannot find -lelf
/bin/ld: cannot find -ldw
/bin/ld: cannot find -laudit
/bin/ld: cannot find -lslang
/bin/ld: cannot find -lperl
libperf.a(target.o): In function `target__parse_uid':
/home/jolsa/kernel.org/linux-perf/tools/perf/util/target.c:79: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /home/jolsa/kernel.org/linux-perf/tools/perf/util/target.c:91: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/libpthread.a(libpthread.o): In function `sem_open':
(.text+0x67eb): warning: the use of mktemp' is dangerous, better use mkstemp'
/bin/ld: cannot find -lpython2.7
/bin/ld: cannot find -lz
/bin/ld: cannot find -lnuma
collect2: error: ld returned 1 exit status
make[1]: *** [perf] Error 1
make: *** [all] Error 2
---

Quoted 2 lines

Any hints what you did to make it pass?
Let's fix it and put test for this in tests/make suite ;-)

/me agrees violently.

I try static builds every now and then, to be able to test perf on ancient systems with userspace that doesn't build perf anymore.

Thanks,

Ingo

#6 lore raw
In reply to Jiri Olsa
perf tools: Fix bfd dependency libraries detection
Commit-ID:  2cf9040714f3e63f94935c9f1ed4e5bc54265ddb
Gitweb:     http://git.kernel.org/tip/2cf9040714f3e63f94935c9f1ed4e5bc54265ddb
Author:     Jiri Olsa <[email protected]>
AuthorDate: Wed, 23 Apr 2014 16:53:25 +0200
Committer:  Jiri Olsa <[email protected]>
CommitDate: Wed, 30 Apr 2014 16:48:50 +0200

perf tools: Fix bfd dependency libraries detection

There's false assumption in the library detection code assuming -liberty and -lz are always present once bfd is detected. The fails on Ubuntu (14.04) as reported by Ingo.

Forcing the bdf dependency libraries detection any time bfd library is detected.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 tools/perf/config/Makefile | 34 +++++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)
tools/perf/config/Makefile +23 -11
index a71fb39..a57d59e 100644
@@ -194,7 +194,10 @@ VF_FEATURE_TESTS =			\
 	stackprotector-all		\
 	timerfd				\
 	libunwind-debug-frame		\
-	bionic
+	bionic				\
+	liberty				\
+	liberty-z			\
+	cplus-demangle
 
 # Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features.
 # If in the future we need per-feature checks/flags for features not
@@ -512,7 +515,21 @@ else
 endif
 
 ifeq ($(feature-libbfd), 1)
-  EXTLIBS += -lbfd -lz -liberty
+  EXTLIBS += -lbfd
+
+  # call all detections now so we get correct
+  # status in VF output
+  $(call feature_check,liberty)
+  $(call feature_check,liberty-z)
+  $(call feature_check,cplus-demangle)
+
+  ifeq ($(feature-liberty), 1)
+    EXTLIBS += -liberty
+  else
+    ifeq ($(feature-liberty-z), 1)
+      EXTLIBS += -liberty -lz
+    endif
+  endif
 endif
 
 ifdef NO_DEMANGLE
@@ -523,15 +540,10 @@ else
     CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
   else
     ifneq ($(feature-libbfd), 1)
-      $(call feature_check,liberty)
-      ifeq ($(feature-liberty), 1)
-        EXTLIBS += -lbfd -liberty
-      else
-        $(call feature_check,liberty-z)
-        ifeq ($(feature-liberty-z), 1)
-          EXTLIBS += -lbfd -liberty -lz
-        else
-          $(call feature_check,cplus-demangle)
+      ifneq ($(feature-liberty), 1)
+        ifneq ($(feature-liberty-z), 1)
+          # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
+          # or any of 'bfd iberty z' trinity
           ifeq ($(feature-cplus-demangle), 1)
             EXTLIBS += -liberty
             CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT