perf tools: Add missing -ldl for gtk build
PATCH 1/1 perf tools: Add missing -ldl for gtk build
If we build perf with NO_LIBPYTHON=1 NO_LIBPERL=1 the '-ldl' is not added to libs build fails if we have gtk2 code in, because it depends on it.
--- tools/perf/config/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/perf/config/Makefile +1 -0
@@ -272,6 +272,7 @@ ifndef NO_GTK2 CFLAGS += -DGTK2_SUPPORT GTK_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) GTK_LIBS := $(shell pkg-config --libs gtk+-2.0 2>/dev/null) + EXTLIBS += -ldl endif endif
Signature · 1 line
1.7.11.7
Quoted 3 lines · Jiri Olsa
If we build perf with NO_LIBPYTHON=1 NO_LIBPERL=1 the '-ldl' is not added to libs build fails if we have gtk2 code in, because it depends on it.
Argh... Thanks for fixing this!
Thanks,
Namhyung
PATCH 1/3 perf tools: Separate lbfd check out of NO_DEMANGLE condition
In reply to Jiri OlsaWe fail build with NO_DEMANGLE with missing -lbfd externals error. The reason is that we now use bfd code in srcline object:
perf tools: Implement addr2line directly using libbfd
So we need to check/add -lbfd always now.
--- tools/perf/config/Makefile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
tools/perf/config/Makefile +8 -9
@@ -360,6 +360,13 @@ else endif endif +FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd +has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) +ifeq ($(has_bfd),y) + EXTLIBS += -lbfd + CFLAGS += -DLIBBFD_SUPPORT +endif + ifdef NO_DEMANGLE CFLAGS += -DNO_DEMANGLE else
@@ -367,11 +374,7 @@ else EXTLIBS += -liberty CFLAGS += -DHAVE_CPLUS_DEMANGLE else - FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd - has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) - ifeq ($(has_bfd),y) - EXTLIBS += -lbfd - else + ifneq ($(has_bfd),y) FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty) ifeq ($(has_bfd_iberty),y)
@@ -397,10 +400,6 @@ else endif endif -ifndef ($(filter -lbfd,$(EXTLIBS)),) - CFLAGS += -DLIBBFD_SUPPORT -endif - ifndef NO_STRLCPY ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y) CFLAGS += -DHAVE_STRLCPY
Signature · 1 line
1.7.11.7
PATCH 2/3 perf tools: Adding missing ifdef for cmd_trace call
We're missing ifdef LIBAUDIT_SUPPORT condition check for calling cmd_trace, otherwise the NO_LIBAUDIT=1 build fails.
Introduced by commit:
perf trace: Add 'trace' alias to 'perf trace'
--- tools/perf/perf.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/perf.c +2 -0
@@ -482,12 +482,14 @@ int main(int argc, const char **argv) goto out; } +#ifdef LIBAUDIT_SUPPORT if (!prefixcmp (cmd,"trace" )) {set_buildid_dir ();setup_path (); argv[0 ] ="trace" ;return cmd_trace (argc, argv,NULL ); } +#endif /* Look for flags.. */ argv++;
Signature · 1 line
1.7.11.7
PATCH 3/3 perf tools: Add missing GTK2_SUPPORT ifdefs
In reply to Jiri OlsaWhen building minimal perf via:
NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
We dont link -ldl and that's causing error for gtk2 related code, which is disabled on command line (NO_GTK2), but not in the code (GTK2_SUPPORT).
We probably need some global fix/change for this browser enabled/disable code.
Tested just by building it corretly.
--- tools/perf/builtin-annotate.c | 6 ++++++ tools/perf/builtin-report.c | 2 ++ 2 files changed, 8 insertions(+)
tools/perf/builtin-annotate.c +6 -0
@@ -142,6 +142,7 @@ find_next: }if (use_browser ==2 ) { +#ifdef GTK2_SUPPORT int ret; int (*annotate)(struct hist_entry *he, struct perf_evsel *evsel,
@@ -161,6 +162,9 @@ find_next:/* skip missing symbols */ nd = rb_next(nd); }else if (use_browser ==1 ) { +#else + use_browser =1 ; +#endif key =hist_entry__tui_annotate (he, evsel,NULL );switch (key) {case -1 :
@@ -258,6 +262,7 @@ static int __cmd_annotate(struct perf_annotate *ann) goto out_delete; } +#ifdef GTK2_SUPPORT if (use_browser ==2 ) {void (*show_annotations)(void );
@@ -269,6 +274,7 @@ static int __cmd_annotate(struct perf_annotate *ann) }show_annotations (); } +#endif out_delete:/*
tools/perf/builtin-report.c +2 -0
@@ -591,6 +591,7 @@ static int __cmd_report(struct perf_report *rep) ret =0 ; }else if (use_browser ==2 ) { +#ifdef GTK2_SUPPORT int (*hist_browser)(struct perf_evlist *, const char *, struct hist_browser_timer *,
@@ -604,6 +605,7 @@ static int __cmd_report(struct perf_report *rep) }hist_browser (session->evlist, help,NULL , rep->min_percent); +#endif } }else perf_evlist__tty_browse_hists (session->evlist, rep, help);
Signature · 1 line
1.7.11.7
Re: [BUG/RFC 3/3] perf tools: Add missing GTK2_SUPPORT ifdefs
Em Fri, Sep 27, 2013 at 04:32:12PM +0200, Jiri Olsa escreveu:
Quoted 11 lines
When building minimal perf via:
NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1We dont link -ldl and that's causing error for gtk2 related code, which is disabled on command line (
NO_GTK2), but not in the code (GTK2_SUPPORT).We probably need some global fix/change for this browser enabled/disable code.
But for now what you did is enough, since the only module that uses the dl mechanism is the GTK+ one, so I'm applying it.
I should have detected this before pushing out perf/core with the changes that introduced this problem, that is what:
make -C tools/perf -f tests/make
was made to catch, my bad, Namhyung, please use those tests next time too :-)
Quoted 1 line
Tested just by building it corretly.
Yeah, now tests/make completes without problems.
Thanks,
- Arnaldo
Quoted 73 lines
Signed-off-by Jiri Olsa <[email protected]>Cc Corey Ashford <[email protected]>Cc Ingo Molnar <[email protected]>Cc Namhyung Kim <[email protected]>Cc Paul Mackerras <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc David Ahern <[email protected]>--- tools/perf/builtin-annotate.c | 6 ++++++ tools/perf/builtin-report.c | 2 ++ 2 files changed, 8 insertions(+)tools/perf/builtin-annotate.c +6
-0@@ -142,6 +142,7 @@ find_next: }if (use_browser ==2 ) { +#ifdef GTK2_SUPPORT int ret; int (*annotate)(struct hist_entry *he, struct perf_evsel *evsel,@@ -161,6 +162,9 @@ find_next:/* skip missing symbols */ nd = rb_next(nd); }else if (use_browser ==1 ) { +#else + use_browser =1 ; +#endif key =hist_entry__tui_annotate (he, evsel,NULL );switch (key) {case -1 :@@ -258,6 +262,7 @@ static int __cmd_annotate(struct perf_annotate *ann) goto out_delete; } +#ifdef GTK2_SUPPORT if (use_browser ==2 ) {void (*show_annotations)(void );@@ -269,6 +274,7 @@ static int __cmd_annotate(struct perf_annotate *ann) }show_annotations (); } +#endif out_delete:/* tools/perf/builtin-report.c +2
-0@@ -591,6 +591,7 @@ static int __cmd_report(struct perf_report *rep) ret =0 ; }else if (use_browser ==2 ) { +#ifdef GTK2_SUPPORT int (*hist_browser)(struct perf_evlist *, const char *, struct hist_browser_timer *,@@ -604,6 +605,7 @@ static int __cmd_report(struct perf_report *rep) }hist_browser (session->evlist, help,NULL , rep->min_percent); +#endif } }else perf_evlist__tty_browse_hists (session->evlist, rep, help);Signature · 1 line
1.7.11.7
Namhyung Kim
maintainerRe: [BUG/RFC 3/3] perf tools: Add missing GTK2_SUPPORT ifdefs
Hi Arnaldo,
2013-09-27 (금), 15:54 -0300, Arnaldo Carvalho de Melo:
Quoted 16 lines
Em Fri, Sep 27, 2013 at 04:32:12PM +0200, Jiri Olsa escreveu:
Quoted 11 lines
When building minimal perf via:
NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1We dont link -ldl and that's causing error for gtk2 related code, which is disabled on command line (
NO_GTK2), but not in the code (GTK2_SUPPORT).We probably need some global fix/change for this browser enabled/disable code.
But for now what you did is enough, since the only module that uses the dl mechanism is the GTK+ one, so I'm applying it.
Quoted 7 lines
I should have detected this before pushing out perf/core with the changes that introduced this problem, that is what:
make -C
tools/perf-f tests/makewas made to catch, my bad, Namhyung, please use those tests next time too :-)
I almost forgot about that, sorry. Will do the tests next time.
Thanks,
Namhyung
Namhyung Kim
maintainerRe: [PATCH 1/3] perf tools: Separate lbfd check out of NO_DEMANGLE condition
In reply to Jiri OlsaHi Jiri,
2013-09-27 (금), 16:32 +0200, Jiri Olsa:
Quoted 50 lines
We fail build with
NO_DEMANGLEwith missing -lbfd externals error. The reason is that we now use bfd code in srcline object:
perf tools: Implement addr2line directly using libbfdSo we need to check/add -lbfd always now.
Signed-off-by Jiri Olsa <[email protected]>Cc Corey Ashford <[email protected]>Cc Ingo Molnar <[email protected]>Cc Namhyung Kim <[email protected]>Cc Paul Mackerras <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc David Ahern <[email protected]>--- tools/perf/config/Makefile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)tools/perf/config/Makefile +8
-5@@ -360,6 +360,13 @@ else endif endif +FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd +has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) +ifeq ($(has_bfd),y) + EXTLIBS += -lbfd + CFLAGS += -DLIBBFD_SUPPORT +endif + ifdef NO_DEMANGLE CFLAGS += -DNO_DEMANGLE else@@ -367,11 +374,7 @@ else EXTLIBS += -liberty CFLAGS += -DHAVE_CPLUS_DEMANGLE else - FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd - has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) - ifeq ($(has_bfd),y) - EXTLIBS += -lbfd - else + ifneq ($(has_bfd),y) FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty) ifeq ($(has_bfd_iberty),y)
tools/perf/config/Makefile else · line 405
Quoted 10 lines
tools/perf/config/Makefile +0
-4@@ -397,10 +400,6 @@ else endif endif -ifndef ($(filter -lbfd,$(EXTLIBS)),) - CFLAGS += -DLIBBFD_SUPPORT -endif - ifndef NO_STRLCPY ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y) CFLAGS += -DHAVE_STRLCPY
Is it enough to check on -lbfd only? I guess libbfd can have additional dependencies to libiberty and libz. If so, this patch can fail to set -DLIBBFD_SUPPORT, right?
Thanks,
Namhyung
Re: [PATCH 1/3] perf tools: Separate lbfd check out of NO_DEMANGLE condition
Quoted 56 lines · Namhyung Kim
Hi Jiri,
2013-09-27 (금), 16:32 +0200, Jiri Olsa:
Quoted 53 lines
We fail build with
NO_DEMANGLEwith missing -lbfd externals error. The reason is that we now use bfd code in srcline object:
perf tools: Implement addr2line directly using libbfdSo we need to check/add -lbfd always now.
Signed-off-by Jiri Olsa <[email protected]>Cc Corey Ashford <[email protected]>Cc Ingo Molnar <[email protected]>Cc Namhyung Kim <[email protected]>Cc Paul Mackerras <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc David Ahern <[email protected]>--- tools/perf/config/Makefile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)tools/perf/config/Makefile +8
-5@@ -360,6 +360,13 @@ else endif endif +FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd +has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) +ifeq ($(has_bfd),y) + EXTLIBS += -lbfd + CFLAGS += -DLIBBFD_SUPPORT +endif + ifdef NO_DEMANGLE CFLAGS += -DNO_DEMANGLE else@@ -367,11 +374,7 @@ else EXTLIBS += -liberty CFLAGS += -DHAVE_CPLUS_DEMANGLE else - FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd - has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) - ifeq ($(has_bfd),y) - EXTLIBS += -lbfd - else + ifneq ($(has_bfd),y) FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty) ifeq ($(has_bfd_iberty),y)@@ -397,10 +400,6 @@ else endif endif
Quoted 11 lines
tools/perf/config/Makefile else · line 405
Quoted 7 lines
tools/perf/config/Makefile +0
-4-ifndef ($(filter -lbfd,$(EXTLIBS)),) - CFLAGS += -DLIBBFD_SUPPORT -endif - ifndef NO_STRLCPY ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y) CFLAGS += -DHAVE_STRLCPYIs it enough to check on -lbfd only? I guess libbfd can have additional dependencies to libiberty and libz. If so, this patch can fail to set -DLIBBFD_SUPPORT, right?
hum, you're right.. so it's 2 bugs fixed by removing that code ;-)
jirka
Namhyung Kim
maintainerRe: [PATCH 1/3] perf tools: Separate lbfd check out of NO_DEMANGLE condition
In reply to Namhyung KimHi Jiri,
Quoted 56 lines · Namhyung Kim
Hi Jiri,
2013-09-27 (금), 16:32 +0200, Jiri Olsa:
Quoted 53 lines
We fail build with
NO_DEMANGLEwith missing -lbfd externals error. The reason is that we now use bfd code in srcline object:
perf tools: Implement addr2line directly using libbfdSo we need to check/add -lbfd always now.
Signed-off-by Jiri Olsa <[email protected]>Cc Corey Ashford <[email protected]>Cc Ingo Molnar <[email protected]>Cc Namhyung Kim <[email protected]>Cc Paul Mackerras <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc David Ahern <[email protected]>--- tools/perf/config/Makefile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)tools/perf/config/Makefile +8
-5@@ -360,6 +360,13 @@ else endif endif +FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd +has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) +ifeq ($(has_bfd),y) + EXTLIBS += -lbfd + CFLAGS += -DLIBBFD_SUPPORT +endif + ifdef NO_DEMANGLE CFLAGS += -DNO_DEMANGLE else@@ -367,11 +374,7 @@ else EXTLIBS += -liberty CFLAGS += -DHAVE_CPLUS_DEMANGLE else - FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd - has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) - ifeq ($(has_bfd),y) - EXTLIBS += -lbfd - else + ifneq ($(has_bfd),y) FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty) ifeq ($(has_bfd_iberty),y)@@ -397,10 +400,6 @@ else endif endif
Quoted 11 lines
tools/perf/config/Makefile else · line 405
Quoted 7 lines
tools/perf/config/Makefile +0
-4-ifndef ($(filter -lbfd,$(EXTLIBS)),) - CFLAGS += -DLIBBFD_SUPPORT -endif - ifndef NO_STRLCPY ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y) CFLAGS += -DHAVE_STRLCPYIs it enough to check on -lbfd only? I guess libbfd can have additional dependencies to libiberty and libz. If so, this patch can fail to set -DLIBBFD_SUPPORT, right?
I tested this on my system. At first I guessed (without testing) it cannot build SOURCE_BFD with -lbfd only due to additional -liberty and -lz dependency, but it's not. Actually the libfd.so is a plain text file which contains linker script like this:
$ file /lib64/libbfd.so /lib64/libbfd.so: ASCII text
$ cat /lib64/libbfd.so /* GNU ld script */
/* Ensure this .so library will not be used by a link for a different format
on a multi-architecture system. */
OUTPUT_FORMAT(elf64-x86-64)
/* The libz dependency is unexpected by legacy build scripts. */ INPUT ( /usr/lib64/libbfd.a -liberty -lz )
So it should handle external dependencies. But it doesn't.
$ cat bfd.c #include <bfd.h>
int main(void)
{
bfd_demangle(0, 0, 0);
return 0;
}namhyung@sejong:tmp$ gcc bfd.c -lbfd /usr/lib64/libbfd.a(plugin.o): In function `try_load_plugin': (.text+0x1ab): undefined reference to `dlopen' /usr/lib64/libbfd.a(plugin.o): In function `try_load_plugin': (.text+0x1ca): undefined reference to `dlsym' /usr/lib64/libbfd.a(plugin.o): In function `try_load_plugin': (.text+0x263): undefined reference to `dlerror' collect2: error: ld returned 1 exit status
It seems that it needs libdl for loading plugins. Adding -ldl makes above build successfully. So we need to add -ldl for EXTLIBS IMHO. Without it, make NO_GTK2=1 NO_LIBPERL=1 NO_LIBPYTHON=1 will fail to check libbfd correctly (FYI, libperl and libpython add -ldl to the dependency list).
Thanks,
Namhyung
Re: [PATCH 1/3] perf tools: Separate lbfd check out of NO_DEMANGLE condition
Quoted 111 lines · Namhyung Kim
Hi Jiri,
Quoted 56 lines · Namhyung Kim
Hi Jiri,
2013-09-27 (금), 16:32 +0200, Jiri Olsa:
Quoted 53 lines
We fail build with
NO_DEMANGLEwith missing -lbfd externals error. The reason is that we now use bfd code in srcline object:
perf tools: Implement addr2line directly using libbfdSo we need to check/add -lbfd always now.
Signed-off-by Jiri Olsa <[email protected]>Cc Corey Ashford <[email protected]>Cc Ingo Molnar <[email protected]>Cc Namhyung Kim <[email protected]>Cc Paul Mackerras <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc David Ahern <[email protected]>--- tools/perf/config/Makefile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)tools/perf/config/Makefile +8
-5@@ -360,6 +360,13 @@ else endif endif +FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd +has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) +ifeq ($(has_bfd),y) + EXTLIBS += -lbfd + CFLAGS += -DLIBBFD_SUPPORT +endif + ifdef NO_DEMANGLE CFLAGS += -DNO_DEMANGLE else@@ -367,11 +374,7 @@ else EXTLIBS += -liberty CFLAGS += -DHAVE_CPLUS_DEMANGLE else - FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd - has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) - ifeq ($(has_bfd),y) - EXTLIBS += -lbfd - else + ifneq ($(has_bfd),y) FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty) ifeq ($(has_bfd_iberty),y)@@ -397,10 +400,6 @@ else endif endifQuoted 11 lines
tools/perf/config/Makefile else · line 405
Quoted 7 lines
tools/perf/config/Makefile +0
-4-ifndef ($(filter -lbfd,$(EXTLIBS)),) - CFLAGS += -DLIBBFD_SUPPORT -endif - ifndef NO_STRLCPY ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y) CFLAGS += -DHAVE_STRLCPYIs it enough to check on -lbfd only? I guess libbfd can have additional dependencies to libiberty and libz. If so, this patch can fail to set -DLIBBFD_SUPPORT, right?
I tested this on my system. At first I guessed (without testing) it cannot build
SOURCE_BFDwith -lbfd only due to additional -liberty and -lz dependency, but it's not. Actually the libfd.so is a plain text file which contains linker script like this:$ file /lib64/libbfd.so /lib64/libbfd.so: ASCII text$ cat /lib64/libbfd.so /* GNU ld script *//* Ensure this .so library will not be used by a link for a different format
on a multi-architecture system. */
OUTPUT_FORMAT(elf64-x86-64)/* The libz dependency is unexpected by legacy build scripts. */ INPUT (
/usr/lib64/libbfd.a-liberty -lz )So it should handle external dependencies. But it doesn't.
$ cat bfd.c #include <bfd.h>int main(void) { bfd_demangle(0, 0, 0); return 0; }namhyung@sejong:tmp$ gcc bfd.c -lbfd /usr/lib64/libbfd.a(plugin.o): In function `try_load_plugin': (.text+0x1ab): undefined reference to `dlopen' /usr/lib64/libbfd.a(plugin.o): In function `try_load_plugin': (.text+0x1ca): undefined reference to `dlsym' /usr/lib64/libbfd.a(plugin.o): In function `try_load_plugin': (.text+0x263): undefined reference to `dlerror' collect2: error: ld returned 1 exit status
Quoted 5 lines
It seems that it needs libdl for loading plugins. Adding -ldl makes above build successfully. So we need to add -ldl for EXTLIBS IMHO. Without it, make NO_GTK2=1 NO_LIBPERL=1 NO_LIBPYTHON=1 will fail to check libbfd correctly (FYI, libperl and libpython add -ldl to the dependency list).
hum, so on my system -liberty check wins without -lbfd, so 'NO_GTK2=1 NO_LIBPERL=1 NO_LIBPYTHON=1' passes
I need to check Ingo's latest changes on this, not sure how if this problem is relevant any longer ;-)
jirka
Namhyung Kim
maintainerRe: [PATCH 1/3] perf tools: Separate lbfd check out of NO_DEMANGLE condition
Hi Jiri,
Quoted 7 lines · Jiri Olsa
Quoted 5 lines · Namhyung Kim
It seems that it needs libdl for loading plugins. Adding -ldl makes above build successfully. So we need to add -ldl for EXTLIBS IMHO. Without it, make NO_GTK2=1 NO_LIBPERL=1 NO_LIBPYTHON=1 will fail to check libbfd correctly (FYI, libperl and libpython add -ldl to the dependency list).
Quoted 5 lines
hum, so on my system -liberty check wins without -lbfd, so 'NO_GTK2=1 NO_LIBPERL=1 NO_LIBPYTHON=1' passes
I need to check Ingo's latest changes on this, not sure how if this problem is relevant any longer ;-)
AFAICS, Ingo's patch does "-lbfd -ldl" rather than "-lbfd". So probably there's no problem then. :)
Thanks,
Namhyung
Re: [PATCH 1/3] perf tools: Separate lbfd check out of NO_DEMANGLE condition
Quoted 10 lines · Namhyung Kim
Hi Jiri,
Quoted 7 lines · Jiri Olsa
Quoted 5 lines · Namhyung Kim
It seems that it needs libdl for loading plugins. Adding -ldl makes above build successfully. So we need to add -ldl for EXTLIBS IMHO. Without it, make NO_GTK2=1 NO_LIBPERL=1 NO_LIBPYTHON=1 will fail to check libbfd correctly (FYI, libperl and libpython add -ldl to the dependency list).
Quoted 8 lines
Quoted 5 lines
hum, so on my system -liberty check wins without -lbfd, so 'NO_GTK2=1 NO_LIBPERL=1 NO_LIBPYTHON=1' passes
I need to check Ingo's latest changes on this, not sure how if this problem is relevant any longer ;-)
AFAICS, Ingo's patch does "-lbfd -ldl" rather than "-lbfd". So probably there's no problem then. :)
I didn't fully demangle the maze of demangler feature tests yet :-) I added a single testcase, the rest is still detected using the old method.
Any assymetry in detection is probably a bug in my patches.
If that nested series of conditions is really necessary then we can add separate testcases for each, the same file built with different linker flags.
Thanks,
Ingo
tip-bot for Jiri Olsa
merge botperf tools: Add missing -ldl for gtk build
Commit-ID: e2137086be7bc52893a790292635cfafc475b693 Gitweb: http://git.kernel.org/tip/e2137086be7bc52893a790292635cfafc475b693 Author: Jiri Olsa <[email protected]> AuthorDate: Thu, 26 Sep 2013 20:55:54 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 11 Oct 2013 12:17:29 -0300
perf tools: Add missing -ldl for gtk build
If we build perf with NO_LIBPYTHON=1 NO_LIBPERL=1 the '-ldl' is not added to libs build fails if we have gtk2 code in, because it depends on it.
--- tools/perf/config/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/perf/config/Makefile +1 -0
@@ -382,6 +382,7 @@ ifndef NO_GTK2 CFLAGS += -DHAVE_GTK2_SUPPORT GTK_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) GTK_LIBS := $(shell pkg-config --libs gtk+-2.0 2>/dev/null) + EXTLIBS += -ldl endif endif