2013-06-11 15:23:02

by Robert Richter

[permalink] [raw]
Subject: [PATCH] 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

Cc: Jiri Olsa <[email protected]>
Signed-off-by: Robert Richter <[email protected]>
Signed-off-by: Robert Richter <[email protected]>
---
tools/perf/Makefile | 5 ++---
tools/perf/config/Makefile | 2 +-
2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 203cb0e..641fccd 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -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
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index f139dcd..f446895 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -39,7 +39,7 @@ src-perf := $(srctree)/tools/perf
endif

ifeq ($(obj-perf),)
-obj-perf := $(objtree)
+obj-perf := $(OUTPUT)
endif

ifneq ($(obj-perf),)
--
1.8.1.1


Subject: [tip:perf/urgent] 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

Signed-off-by: Robert Richter <[email protected]>
Signed-off-by: Robert Richter <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Robert Richter <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/Makefile | 5 ++---
tools/perf/config/Makefile | 2 +-
2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 203cb0e..641fccd 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -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
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index f139dcd..f446895 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -39,7 +39,7 @@ src-perf := $(srctree)/tools/perf
endif

ifeq ($(obj-perf),)
-obj-perf := $(objtree)
+obj-perf := $(OUTPUT)
endif

ifneq ($(obj-perf),)

2013-07-12 09:39:19

by Robert Richter

[permalink] [raw]
Subject: Re: [tip:perf/urgent] perf tools: Fix build errors with O and DESTDIR make vars set

On 12.07.13 01:49:40, tip-bot for Robert Richter wrote:
> 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
> ...

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

2013-07-16 14:50:43

by Robert Richter

[permalink] [raw]
Subject: [PATCH] perf tools: Fix 'make tools/perf'

On 12.07.13 10:39:09, Robert Richter wrote:

> On 12.07.13 01:49:40, tip-bot for Robert Richter wrote:
> > 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

> $ 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


>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

Reported-by: Borislav Petkov <[email protected]>
Signed-off-by: Robert Richter <[email protected]>
Signed-off-by: Robert Richter <[email protected]>
---
tools/perf/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 641fccd..1d718a9 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -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
--
1.8.3.2

2013-07-17 15:31:36

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH] perf tools: Fix 'make tools/perf'

Em Tue, Jul 16, 2013 at 04:50:36PM +0200, Robert Richter escreveu:
> 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

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

2013-07-17 15:40:07

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH] perf tools: Fix 'make tools/perf'

On Wed, Jul 17, 2013 at 12:31:18PM -0300, Arnaldo Carvalho de Melo wrote:
> 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.

--
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

2013-07-17 16:10:58

by Robert Richter

[permalink] [raw]
Subject: Re: [PATCH] perf tools: Fix 'make tools/perf'

On 17.07.13 17:40:01, Borislav Petkov wrote:
> On Wed, Jul 17, 2013 at 12:31:18PM -0300, Arnaldo Carvalho de Melo wrote:
> > 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.

>
> 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

2013-07-18 12:19:32

by Robert Richter

[permalink] [raw]
Subject: 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.

On 17.07.13 18:10:51, Robert Richter wrote:
> On 17.07.13 17:40:01, Borislav Petkov wrote:
> > On Wed, Jul 17, 2013 at 12:31:18PM -0300, Arnaldo Carvalho de Melo wrote:
> > > 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

2013-07-18 16:19:23

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH] perf tools: Fix 'make tools/perf'

Em Thu, Jul 18, 2013 at 02:19:24PM +0200, Robert Richter escreveu:
> 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

> On 17.07.13 18:10:51, Robert Richter wrote:
> > On 17.07.13 17:40:01, Borislav Petkov wrote:
> > > On Wed, Jul 17, 2013 at 12:31:18PM -0300, Arnaldo Carvalho de Melo wrote:
> > > > 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

2013-07-18 16:41:23

by Robert Richter

[permalink] [raw]
Subject: [PATCH] perf tools: Build docs with 'make all'

Arnaldo,

On 18.07.13 14:19:24, Robert Richter wrote:
> 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



>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.

Signed-off-by: Robert Richter <[email protected]>
Signed-off-by: Robert Richter <[email protected]>
---
tools/perf/Documentation/Makefile | 6 ++++--
tools/perf/Makefile | 7 +++++--
2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Documentation/Makefile b/tools/perf/Documentation/Makefile
index 5a37a7c..47df22d 100644
--- a/tools/perf/Documentation/Makefile
+++ b/tools/perf/Documentation/Makefile
@@ -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
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 1d718a9..8781de7 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -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)
--
1.8.3.2

2013-07-18 16:47:54

by Robert Richter

[permalink] [raw]
Subject: Re: [PATCH] perf tools: Fix 'make tools/perf'

On 18.07.13 13:19:13, Arnaldo Carvalho de Melo wrote:
> Em Thu, Jul 18, 2013 at 02:19:24PM +0200, Robert Richter escreveu:
> > 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.

> > 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:

diff --git a/tools/perf/Documentation/Makefile b/tools/perf/Documentation/Makefile
index 47df22d..1d6e045 100644
--- a/tools/perf/Documentation/Makefile
+++ b/tools/perf/Documentation/Makefile
@@ -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

Subject: [tip:perf/core] 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

Reported-by: Borislav Petkov <[email protected]>
Signed-off-by: Robert Richter <[email protected]>
Signed-off-by: Robert Richter <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 5b7c6db..2a69026 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -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