Skip to contentSkip to conversation

linux-next: build failure in dwarf-regs.c

PATCH In review Ian Munsie 5 participants 6 messages Oct 2, 2012 – Oct 3, 2012 1 message not in the archive perf events

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CAOvdn6WPUDqYPpHZip7dxVVXJXT0-zJOUCpgDGb=o+zqq98F0Q@mail.gmail.com

Ian Munsie

author
#1 lore raw

Hey Ben,

Adding some people to CC...

Excerpts from Ben Guthro's message of 2012-10-02 11:02:59 +1000:

Quoted 2 lines

I pulled the latest bits up to 797b9e5ae93270ec27a1f1ed48cd697d01b2269f - but am seeing the following build failure with gcc 4.6.3

Building that SHA works for me (on x86, haven't tried PPC yet)...

Quoted 1 line

CC arch/x86/util/dwarf-regs.o

Is this correct? i.e. Are you building perf for x86?

What commandline are you using to build?

Any exported environment variables that may be relevant?

What dev libraries does perf warn is missing (Is libdw-dev among them)?

Quoted 2 lines

arch/x86/util/dwarf-regs.c:72:13: error: no previous prototype for 'get_arch_regstr' [-Werror=missing-prototypes]

Hmmm... util/include/dwarf-regs.h not included? DWARF_SUPPORT undefined but still building that file for some reason?

Can't see any obvious way that could happen... You didn't happen to see an warning along the lines of 'DWARF register mappings not defined for x86' did you?

Quoted 1 line

`/data/home/bguthro/dev/orc-newdev.git/linux/build/tools/tools/perf'

I hope the two 'tools' here is just an O= artefact?

Quoted 2 lines

git blame shows that line coming in from the following changeset - though April is a long time ago in kernel time

Especially when it's April from two years ago...

Quoted 1 line

- so this must have come in with some other merge in this 3.7 window

Seems likely, especially as (excerpt from git diff --stat v3.6 797b9e5 -- tools/perf):

tools/perf/arch/x86/Makefile            | 3 +
tools/perf/arch/x86/include/perf_regs.h | 80 +++
tools/perf/Makefile                     | 173 ++++--

I see a few changes in there that may have caused this... Since I can't reproduce this myself I can't narrow it down, so I'm adding David Ahern, Namhyung Kim & Jiri Olsa to CC who have touched lines that look like the might be relevant.

Ben: You should be able to narrow down the cause of the breakage a bit more with git bisect start 797b9e5 v3.6 -- tools/perf/Makefile

Cheers,
-Ian

#2 lore raw

Hi Ian,

Once again - apologies for multiple copies of this email. Please reply to this (plain text) version so it will get through LKML filters.

Quoted 5 lines · Ian Munsie
Quoted 3 lines

CC arch/x86/util/dwarf-regs.o

Is this correct? i.e. Are you building perf for x86?

Yes, x86_64, specifically.

Quoted 2 lines

What commandline are you using to build?

cd /data/home/bguthro/dev/orc-newdev.git/linux/build/tools/tools/perf && make EXTRAVERSION=-orc

Quoted 2 lines

Any exported environment variables that may be relevant?

none that I can think of.

Quoted 2 lines

What dev libraries does perf warn is missing (Is libdw-dev among them)?

make[3]: Entering directory `/data/home/bguthro/dev/orc-newdev.git/linux/build/tools/tools/perf' Makefile:502: No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99
Makefile:537: 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
Makefile:567: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
Makefile:580: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
Makefile:752: No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling

Actually - I hadn't noticed these warnings before.

After installing libdw-dev - the perf build completed successfully. Perhaps this should be fatal, rather than a warning?

Thanks for your help

Ben

#3 lore raw

PATCH 1/1 perf tool: Fix build for NO_DWARF=1 case

Quoted 42 lines · Ben Guthro

Hi Ian,

Once again - apologies for multiple copies of this email. Please reply to this (plain text) version so it will get through LKML filters.

Quoted 5 lines · Ian Munsie
Quoted 3 lines

CC arch/x86/util/dwarf-regs.o

Is this correct? i.e. Are you building perf for x86?

Yes, x86_64, specifically.

Quoted 2 lines

What commandline are you using to build?

cd /data/home/bguthro/dev/orc-newdev.git/linux/build/tools/tools/perf && make EXTRAVERSION=-orc

Quoted 2 lines

Any exported environment variables that may be relevant?

none that I can think of.

Quoted 2 lines

What dev libraries does perf warn is missing (Is libdw-dev among them)?

make[3]: Entering directory `/data/home/bguthro/dev/orc-newdev.git/linux/build/tools/tools/perf' Makefile:502: No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99
Makefile:537: 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
Makefile:567: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
Makefile:580: newt not found, disables TUI support. Please install newt-devel or libnewt-dev
Makefile:752: No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling

Quoted 8 lines

Actually - I hadn't noticed these warnings before.

After installing libdw-dev - the perf build completed successfully. Perhaps this should be fatal, rather than a warning?

Thanks for your help

Ben

hi,
attached patch fixies the issue for me. Adding Arnaldo to the loop.

jirka

---
We need to include arch Makefile after we decide the NO_DWARF value, otherwise we get might get build failure.

The reason is the arch Makefile could include objects based on the NO_DWARF value, as it is for x86 case.

Cc Peter Zijlstra <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/Makefile +2 -2
index 6958ba4..0ca8f45 100644
@@ -505,8 +505,6 @@ ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND)),y)
 endif # Libunwind support
 endif # NO_LIBUNWIND
 
--include arch/$(ARCH)/Makefile
-
 ifneq ($(OUTPUT),)
 	BASIC_CFLAGS += -I$(OUTPUT)
 endif
@@ -635,6 +633,8 @@ else
 	endif
 endif
 
+-include arch/$(ARCH)/Makefile
+
 disable-python = $(eval $(disable-python_code))
 define disable-python_code
   BASIC_CFLAGS += -DNO_LIBPYTHON
Signature · 1 line
1.7.11.4
#4 lore raw

Re: [PATCH] perf tool: Fix build for NO_DWARF=1 case

Em Tue, Oct 02, 2012 at 03:10:49PM +0200, Jiri Olsa escreveu:

Quoted 7 lines · Ben Guthro
Quoted 4 lines

Actually - I hadn't noticed these warnings before.

After installing libdw-dev - the perf build completed successfully. Perhaps this should be fatal, rather than a warning?

attached patch fixies the issue for me. Adding Arnaldo to the loop.

[acme@sandy linux]$ make -j8 -C tools/perf/ LIBUNWIND_DIR=/opt/libunwind O=/home/acme/git/build/perf install
cc1: warnings being treated as errors
arch/x86/util/dwarf-regs.c:72: error: no previous prototype for ‘get_arch_regstr’
make: *** [/home/acme/git/build/perf/arch/x86/util/dwarf-regs.o] Error 1
make: *** Waiting for unfinished jobs....
make: Leaving directory `/home/git/linux/tools/perf'
[acme@sandy linux]$

- Arnaldo

#5 lore raw

Re: [PATCH] perf tool: Fix build for NO_DWARF=1 case

Quoted 17 lines · Arnaldo Carvalho de Melo

Em Tue, Oct 02, 2012 at 03:10:49PM +0200, Jiri Olsa escreveu:

Quoted 7 lines · Ben Guthro
Quoted 4 lines

Actually - I hadn't noticed these warnings before.

After installing libdw-dev - the perf build completed successfully. Perhaps this should be fatal, rather than a warning?

attached patch fixies the issue for me. Adding Arnaldo to the loop.

[acme@sandy linux]$ make -j8 -C tools/perf/ LIBUNWIND_DIR=/opt/libunwind O=/home/acme/git/build/perf install
cc1: warnings being treated as errors
arch/x86/util/dwarf-regs.c:72: error: no previous prototype for ‘get_arch_regstr’
make: *** [/home/acme/git/build/perf/arch/x86/util/dwarf-regs.o] Error 1
make: *** Waiting for unfinished jobs....
make: Leaving directory `/home/git/linux/tools/perf'
[acme@sandy linux]$

Quoted 1 line

- Arnaldo

ugh.. forgot the way you build perf ;)
(also smells like 'automated make test' adept)

Anyway, there's Makefile dependency on PERF_HAVE_DWARF_REGS which is defined in arch/x86/Makefile.

So, there's only one right place for '-include arch/$(ARCH)/Makefile'. We should think of some other solution, since this seems fragile.

I checked your make and simple make with attached patch (only x86_64 arch, and with and without libdw installed).

jirka

---
We need to include arch Makefile after we decide the NO_DWARF, otherwise we get might get build failure.

The reason is the arch Makefile could include objects based on the NO_DWARF value, as it is for x86 case.

Cc Peter Zijlstra <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/Makefile +2 -2
index 6958ba4..c287c1d 100644
@@ -505,8 +505,6 @@ ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND)),y)
 endif # Libunwind support
 endif # NO_LIBUNWIND
 
--include arch/$(ARCH)/Makefile
-
 ifneq ($(OUTPUT),)
 	BASIC_CFLAGS += -I$(OUTPUT)
 endif
@@ -539,6 +537,8 @@ ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF)),y)
 	NO_DWARF := 1
 endif # Dwarf support
 
+-include arch/$(ARCH)/Makefile
+
 ifndef NO_DWARF
 ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
 	msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
Signature · 1 line
1.7.11.4
maintainer
#6 lore raw

Re: [PATCH] perf tool: Fix build for NO_DWARF=1 case

Hi all,

Quoted 23 lines · Jiri Olsa
Quoted 17 lines · Arnaldo Carvalho de Melo

Em Tue, Oct 02, 2012 at 03:10:49PM +0200, Jiri Olsa escreveu:

Quoted 7 lines · Ben Guthro
Quoted 4 lines

Actually - I hadn't noticed these warnings before.

After installing libdw-dev - the perf build completed successfully. Perhaps this should be fatal, rather than a warning?

attached patch fixies the issue for me. Adding Arnaldo to the loop.

[acme@sandy linux]$ make -j8 -C tools/perf/ LIBUNWIND_DIR=/opt/libunwind O=/home/acme/git/build/perf install
cc1: warnings being treated as errors
arch/x86/util/dwarf-regs.c:72: error: no previous prototype for ‘get_arch_regstr’
make: *** [/home/acme/git/build/perf/arch/x86/util/dwarf-regs.o] Error 1
make: *** Waiting for unfinished jobs....
make: Leaving directory `/home/git/linux/tools/perf'
[acme@sandy linux]$

Quoted 1 line

- Arnaldo

ugh.. forgot the way you build perf ;)
(also smells like 'automated make test' adept)

Quoted 8 lines

Anyway, there's Makefile dependency on PERF_HAVE_DWARF_REGS which is defined in arch/x86/Makefile.

So, there's only one right place for '-include arch/$(ARCH)/Makefile'. We should think of some other solution, since this seems fragile.

I checked your make and simple make with attached patch (only x86_64 arch, and with and without libdw installed).

I posted similar patch few days ago and it slipped into acme/perf/core:

https://lkml.org/lkml/2012/9/28/194

Can you reproduce it with above change? Anyway, my apologies, sorry for the inconvenience.

Thanks,
Namhyung