Skip to contentSkip to conversation

perf tools: Fix build errors with O and DESTDIR make vars set

PATCH In review Robert Richter 4 participants 12 messages Jun 11, 2013 – Jul 19, 2013 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf tools: Fix build errors with O and DESTDIR make vars set

From: Robert Richter <[email protected]>

Fixing build errors with O and DESTDIR make vars set:

 $ make prefix=/usr/local O=$builddir DESTDIR=$destdir -C tools/ perf
 ...
 make[1]: Entering directory `.../.source/perf/tools/perf'
     CC .../.build/perf/perf/util/parse-events.o
 util/parse-events.c:14:32: fatal error: parse-events-bison.h: No such file or directory
 compilation terminated.
 make[1]: *** [.../.build/perf/perf/util/parse-events.o] Error 1
 ...

and:

     LINK /.../.build/perf/perf/perf

gcc: error: /.../.build/perf/perf//.../.source/perf/tools/lib/lk/liblk.a: No such file or directory

---
 tools/perf/Makefile        | 5 ++---
 tools/perf/config/Makefile | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)
tools/perf/Makefile +2 -3
index 203cb0e..641fccd 100644
@@ -121,17 +121,16 @@ SCRIPT_SH += perf-archive.sh
 grep-libs = $(filter -l%,$(1))
 strip-libs = $(filter-out -l%,$(1))
 
-LK_PATH=$(LK_DIR)
-
 ifneq ($(OUTPUT),)
   TE_PATH=$(OUTPUT)
 ifneq ($(subdir),)
-  LK_PATH=$(OUTPUT)$(LK_DIR)
+  LK_PATH=$(objtree)/lib/lk/
 else
   LK_PATH=$(OUTPUT)
 endif
 else
   TE_PATH=$(TRACE_EVENT_DIR)
+  LK_PATH=$(LK_DIR)
 endif
 
 LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
tools/perf/config/Makefile +1 -1
index f139dcd..f446895 100644
@@ -39,7 +39,7 @@ src-perf := $(srctree)/tools/perf
 endif
 
 ifeq ($(obj-perf),)
-obj-perf := $(objtree)
+obj-perf := $(OUTPUT)
 endif
 
 ifneq ($(obj-perf),)
Signature · 1 line
1.8.1.1
#1 lore raw
perf tools: Fix build errors with O and DESTDIR make vars set
Commit-ID:  107de3724eff5a6fa6474a4d2aa5460b63749ebf
Gitweb:     http://git.kernel.org/tip/107de3724eff5a6fa6474a4d2aa5460b63749ebf
Author:     Robert Richter <[email protected]>
AuthorDate: Tue, 11 Jun 2013 17:22:38 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 8 Jul 2013 17:34:00 -0300

perf tools: Fix build errors with O and DESTDIR make vars set

Fixing build errors with O and DESTDIR make vars set:

 $ make prefix=/usr/local O=$builddir DESTDIR=$destdir -C tools/ perf
 ...
 make[1]: Entering directory `.../.source/perf/tools/perf'
     CC .../.build/perf/perf/util/parse-events.o
 util/parse-events.c:14:32: fatal error: parse-events-bison.h: No such file or directory
 compilation terminated.
 make[1]: *** [.../.build/perf/perf/util/parse-events.o] Error 1
 ...

and:

     LINK /.../.build/perf/perf/perf

gcc: error: /.../.build/perf/perf//.../.source/perf/tools/lib/lk/liblk.a: No such file or directory

---
 tools/perf/Makefile        | 5 ++---
 tools/perf/config/Makefile | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)
tools/perf/Makefile +2 -3
index 203cb0e..641fccd 100644
@@ -121,17 +121,16 @@ SCRIPT_SH += perf-archive.sh
 grep-libs = $(filter -l%,$(1))
 strip-libs = $(filter-out -l%,$(1))
 
-LK_PATH=$(LK_DIR)
-
 ifneq ($(OUTPUT),)
   TE_PATH=$(OUTPUT)
 ifneq ($(subdir),)
-  LK_PATH=$(OUTPUT)$(LK_DIR)
+  LK_PATH=$(objtree)/lib/lk/
 else
   LK_PATH=$(OUTPUT)
 endif
 else
   TE_PATH=$(TRACE_EVENT_DIR)
+  LK_PATH=$(LK_DIR)
 endif
 
 LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
tools/perf/config/Makefile +1 -1
index f139dcd..f446895 100644
@@ -39,7 +39,7 @@ src-perf := $(srctree)/tools/perf
 endif
 
 ifeq ($(obj-perf),)
-obj-perf := $(objtree)
+obj-perf := $(OUTPUT)
 endif
 
 ifneq ($(obj-perf),)
#2 lore raw
Quoted 11 lines · tip-bot for Robert Richter
Commit-ID:  107de3724eff5a6fa6474a4d2aa5460b63749ebf
Gitweb:     http://git.kernel.org/tip/107de3724eff5a6fa6474a4d2aa5460b63749ebf
Author:     Robert Richter <[email protected]>
AuthorDate: Tue, 11 Jun 2013 17:22:38 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 8 Jul 2013 17:34:00 -0300

perf tools: Fix build errors with O and DESTDIR make vars set

Fixing build errors with O and DESTDIR make vars set:

Quoted 8 lines
 $ make prefix=/usr/local O=$builddir DESTDIR=$destdir -C tools/ perf
 ...
 make[1]: Entering directory `.../.source/perf/tools/perf'
     CC .../.build/perf/perf/util/parse-events.o
 util/parse-events.c:14:32: fatal error: parse-events-bison.h: No such file or directory
 compilation terminated.
 make[1]: *** [.../.build/perf/perf/util/parse-events.o] Error 1
 ...

Boris just raised another variant of building perf tools, which unfortunately is broken now:

 $ make tools/perf
     LINK /home/robert/cx/linux/tools/perf/perf
 gcc: error: ../linux/tools/lib/lk/liblk.a: No such file or directory

There is also

 $ make -C tools perf
 $ make -C tools/perf

Plus variants with O= and DESTDIR set.

Looking how to fix this...

-Robert

#3 lore raw

PATCH 1/1 perf tools: Fix 'make tools/perf'

Quoted 8 lines · Robert Richter
Quoted 7 lines · tip-bot for Robert Richter
Commit-ID:  107de3724eff5a6fa6474a4d2aa5460b63749ebf
Gitweb:     http://git.kernel.org/tip/107de3724eff5a6fa6474a4d2aa5460b63749ebf
Author:     Robert Richter <[email protected]>
AuthorDate: Tue, 11 Jun 2013 17:22:38 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 8 Jul 2013 17:34:00 -0300
Quoted 5 lines
Quoted 1 line

perf tools: Fix build errors with O and DESTDIR make vars set

 $ make tools/perf
     LINK /home/robert/cx/linux/tools/perf/perf
 gcc: error: ../linux/tools/lib/lk/liblk.a: No such file or directory

Fix below.

-Robert

Quoted 1 line

From ff89180092114191b1871eaa2b6f18d17124b21e Mon Sep 17 00:00:00 2001

From: Robert Richter <[email protected]>
Date: Tue, 16 Jul 2013 15:46:27 +0200
Subject: [PATCH] perf tools: Fix 'make tools/perf'

Boris just raised another variant of building perf tools which is broken:

 $ make tools/perf
 ...
     LINK /home/robert/cx/linux/tools/perf/perf
 gcc: error: ../linux/tools/lib/lk/liblk.a: No such file or directory

The variant wasn't considered by:

107de37 perf tools: Fix build errors with O and DESTDIR make vars set

There are other variant of building perf too:

 $ make -C tools perf
 $ make -C tools/perf

Plus variants with O= and DESTDIR set.

This patch fixes the above and was tested with the following:

 $ make O=... DESTDIR=... tools/perf
 $ make O=... DESTDIR=... -C tools/ perf
 $ make O=... DESTDIR=... -C tools/perf
 $ make tools/perf
 $ make -C tools/ perf
 $ make -C tools/perf
---
 tools/perf/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile +1 -1
index 641fccd..1d718a9 100644
@@ -124,7 +124,7 @@ strip-libs = $(filter-out -l%,$(1))
 ifneq ($(OUTPUT),)
   TE_PATH=$(OUTPUT)
 ifneq ($(subdir),)
-  LK_PATH=$(objtree)/lib/lk/
+  LK_PATH=$(OUTPUT)/../lib/lk/
 else
   LK_PATH=$(OUTPUT)
 endif
Signature · 1 line
1.8.3.2
#4 lore raw

Re: [PATCH] perf tools: Fix 'make tools/perf'

Em Tue, Jul 16, 2013 at 04:50:36PM +0200, Robert Richter escreveu:

Quoted 7 lines

There are other variant of building perf too:

 $ make -C tools perf
 $ make -C tools/perf

Plus variants with O= and DESTDIR set.

Quoted 8 lines

This patch fixes the above and was tested with the following:

 $ make O=... DESTDIR=... tools/perf
 $ make O=... DESTDIR=... -C tools/ perf
 $ make O=... DESTDIR=... -C tools/perf
 $ make tools/perf
 $ make -C tools/ perf
 $ make -C tools/perf

Thanks, those work now, applied, but can you check all those with actual targets at the end, i.e. like:

make tools/perf install

Humm, probably it will look at the top level 'install' target? There was some discussion about this, right? Can you refresh my mind?

- Arnaldo

#5 lore raw

Re: [PATCH] perf tools: Fix 'make tools/perf'

Quoted 2 lines · Arnaldo Carvalho de Melo

Humm, probably it will look at the top level 'install' target? There was some discussion about this, right? Can you refresh my mind?

that's

make tools/perf_install.

which goes to the target in tools/Makefile as the rest of the tools there.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#6 lore raw

Re: [PATCH] perf tools: Fix 'make tools/perf'

Quoted 3 lines · Borislav Petkov
Quoted 2 lines · Arnaldo Carvalho de Melo

Humm, probably it will look at the top level 'install' target? There was some discussion about this, right? Can you refresh my mind?

Yeah, this

make tools/perf install

does 2 different things and not what you want.

Quoted 7 lines

that's

make tools/perf_install.

which goes to the target in tools/Makefile as the rest of the tools there.

But Boris' one should work.

Thanks,

-Robert

#7 lore raw

Re: [PATCH] perf tools: Fix 'make tools/perf'

Arnaldo,

I noticed you applied the patch to acme/perf/core, but it should be instead in urgent since mainline is broken.

Quoted 4 lines · Robert Richter
Quoted 3 lines · Borislav Petkov
Quoted 2 lines · Arnaldo Carvalho de Melo

Humm, probably it will look at the top level 'install' target? There was some discussion about this, right? Can you refresh my mind?

Now tested with:

make O=... DESTDIR=... tools/perf
make O=... DESTDIR=... tools/perf_install
make O=... DESTDIR=... -C tools/ perf
make O=... DESTDIR=... -C tools/ perf_install
make O=... DESTDIR=... -C tools/perf
make O=... DESTDIR=... -C tools/perf install
make tools/perf
make DESTDIR=... tools/perf_install
make -C tools/ perf
make -C tools/ DESTDIR=... perf_install
make -C tools/perf
make -C tools/perf DESTDIR=... install

No issues noticed, accept that doc is built when running the 'install' target, not 'all'.

Will look at this.

We also should remove dependencies from install targets that trigger a rebuild since 'make install' is run as root. I had a conversation with Linus about this for building the arm kernel, but the same applies also for perf tools. I don't have the time for changing this now, but maybe in some weeks or so.

Thanks,

-Robert

#8 lore raw

Re: [PATCH] perf tools: Fix 'make tools/perf'

Em Thu, Jul 18, 2013 at 02:19:24PM +0200, Robert Richter escreveu:

Quoted 4 lines

Arnaldo,

I noticed you applied the patch to acme/perf/core, but it should be instead in urgent since mainline is broken.

I did it because there are alternative ways to build the tools that don't require this fix, i.e. this is not _strictly_ needed to build the tools.

What do you guys think: a case like this always needs to go to the current release candidate? Ingo?

- Arnaldo

Quoted 35 lines · Robert Richter
Quoted 4 lines · Borislav Petkov
Quoted 3 lines · Arnaldo Carvalho de Melo
Quoted 2 lines

Humm, probably it will look at the top level 'install' target? There was some discussion about this, right? Can you refresh my mind?

Now tested with:

make O=... DESTDIR=... tools/perf
make O=... DESTDIR=... tools/perf_install
make O=... DESTDIR=... -C tools/ perf
make O=... DESTDIR=... -C tools/ perf_install
make O=... DESTDIR=... -C tools/perf
make O=... DESTDIR=... -C tools/perf install
make tools/perf
make DESTDIR=... tools/perf_install
make -C tools/ perf
make -C tools/ DESTDIR=... perf_install
make -C tools/perf
make -C tools/perf DESTDIR=... install

No issues noticed, accept that doc is built when running the 'install' target, not 'all'.

Will look at this.

We also should remove dependencies from install targets that trigger a rebuild since 'make install' is run as root. I had a conversation with Linus about this for building the arm kernel, but the same applies also for perf tools. I don't have the time for changing this now, but maybe in some weeks or so.

Thanks,

-Robert

#9 lore raw

Re: [PATCH] perf tools: Fix 'make tools/perf'

Quoted 10 lines · Arnaldo Carvalho de Melo

Em Thu, Jul 18, 2013 at 02:19:24PM +0200, Robert Richter escreveu:

Quoted 2 lines

I noticed you applied the patch to acme/perf/core, but it should be instead in urgent since mainline is broken.

I did it because there are alternative ways to build the tools that don't require this fix, i.e. this is not _strictly_ needed to build the tools.

What do you guys think: a case like this always needs to go to the current release candidate? Ingo?

Since it worked before with v3.10 this is a regression in v3.11.

Quoted 2 lines
Quoted 2 lines

No issues noticed, accept that doc is built when running the 'install' target, not 'all'.

There is another problem building the doc with xmlto. I noticed odd timestamps leading *.1 files to be rebuilt (note that the .xml file is newer than *.1):

-rw-r--r-- 1 robert robert 5049 2013-07-18 14:57:27.000000000 +0200 perf-diff.1 -rw-r--r-- 1 robert robert 6771 2013-07-18 14:57:27.000207803 +0200 perf-diff.xml

The reason is that xmlto builds the files in /tmp. In my system /tmp is ext3 while /home is ext4. Only ext4 supports nanosecond timestamps. Thus, timestamps are not quite comparable and make is confused a bit.

This would fix this, but I am not sure if we really want this change:

tools/perf/Documentation/Makefile +2 -1
index 47df22d..1d6e045 100644
@@ -273,7 +273,8 @@ $(MAN_HTML): $(OUTPUT)%.html : %.txt
 
 $(OUTPUT)%.1 $(OUTPUT)%.5 $(OUTPUT)%.7 : $(OUTPUT)%.xml
 	$(QUIET_XMLTO)$(RM) $@ && \
-	$(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
+	$(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< && \
+	touch $@
 
 $(OUTPUT)%.xml : %.txt
 	$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \

If so, I will send a patch.

Thanks,

-Robert

#10 lore raw

PATCH 1/1 perf tools: Build docs with 'make all'

In reply to Robert Richter

Arnaldo,

Quoted 4 lines · Robert Richter

No issues noticed, accept that doc is built when running the 'install' target, not 'all'.

Will look at this.

see patch below that fixes the above.

-Robert

Quoted 1 line

From 3bf424ea33526fefbce9f95d4ccfaffd36016a21 Mon Sep 17 00:00:00 2001

From: Robert Richter <[email protected]>
Date: Thu, 18 Jul 2013 17:57:20 +0200
Subject: [PATCH] perf tools: Build docs with 'make all'

Build documentation with 'make all', not 'make install'. We use the new target try-man for this which is similar implemented as try-install-man. Thus, building the doc is skipped if tools for this are missing.

---
 tools/perf/Documentation/Makefile | 6 ++++--
 tools/perf/Makefile               | 7 +++++--
 2 files changed, 9 insertions(+), 4 deletions(-)
tools/perf/Documentation/Makefile +4 -2
index 5a37a7c..47df22d 100644
@@ -182,6 +182,8 @@ ifdef missing_tools
 	$(error "You need to install $(missing_tools) for man pages")
 endif
 
+do-man: man
+
 do-install-man: man
 	$(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
 #	$(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
@@ -192,11 +194,11 @@ do-install-man: man
 
 install-man: check-man-tools man
 
-try-install-man:
+try-install-man try-man:
 ifdef missing_tools
 	$(warning Please install $(missing_tools) to have the man pages installed)
 else
-	$(MAKE) do-install-man
+	$(MAKE) $(patsubst try-%,do-%,$@)
 endif
 
 install-info: info
tools/perf/Makefile +5 -2
index 1d718a9..8781de7 100644
@@ -522,7 +522,7 @@ export INSTALL SHELL_PATH
 
 SHELL = $(SHELL_PATH)
 
-all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
+all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) try-man
 
 please_set_SHELL_PATH_to_a_more_modern_shell:
 	@$$(:)
@@ -710,9 +710,12 @@ endif
 
 DOC_TARGETS := doc man html info pdf
 
-INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
+INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS))
 INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
 
+DOC_TARGETS	    += try-man
+INSTALL_DOC_TARGETS += try-install-man
+
 # 'make doc' should call 'make -C Documentation all'
 $(DOC_TARGETS):
 	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:doc=all)
Signature · 1 line
1.8.3.2
#11 lore raw

[tip:perf/core] perf tools: Fix 'make tools/perf'

In reply to Robert Richter
perf tools: Fix 'make tools/perf'
Commit-ID:  ab4ecda5205b56cb3b8b44f2c18ffdefb24313a2
Gitweb:     http://git.kernel.org/tip/ab4ecda5205b56cb3b8b44f2c18ffdefb24313a2
Author:     Robert Richter <[email protected]>
AuthorDate: Tue, 16 Jul 2013 16:50:36 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 17 Jul 2013 10:40:02 -0300

perf tools: Fix 'make tools/perf'

Boris just raised another variant of building perf tools which is broken:

 $ make tools/perf
 ...
     LINK /home/robert/cx/linux/tools/perf/perf
 gcc: error: ../linux/tools/lib/lk/liblk.a: No such file or directory

The variant wasn't considered by:

107de37 perf tools: Fix build errors with O and DESTDIR make vars set

There are other variant of building perf too:

 $ make -C tools perf
 $ make -C tools/perf

Plus variants with O= and DESTDIR set.

This patch fixes the above and was tested with the following:

 $ make O=... DESTDIR=... tools/perf
 $ make O=... DESTDIR=... -C tools/ perf
 $ make O=... DESTDIR=... -C tools/perf
 $ make tools/perf
 $ make -C tools/ perf
 $ make -C tools/perf
---
 tools/perf/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile +1 -1
index 5b7c6db..2a69026 100644
@@ -124,7 +124,7 @@ strip-libs = $(filter-out -l%,$(1))
 ifneq ($(OUTPUT),)
   TE_PATH=$(OUTPUT)
 ifneq ($(subdir),)
-  LK_PATH=$(objtree)/lib/lk/
+  LK_PATH=$(OUTPUT)/../lib/lk/
 else
   LK_PATH=$(OUTPUT)
 endif