linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Bug 116411: tools/perf_clean: output directory does not exist. Stop.
       [not found] ` <20160415160002.GP9056@kernel.org>
@ 2016-04-17  0:31   ` TJ
  0 siblings, 0 replies; 3+ messages in thread
From: TJ @ 2016-04-17  0:31 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: linux-kernel, Peter Zijlstra, Ingo Molnar

On 15-04-2016 17:00, Arnaldo Carvalho de Melo wrote:
----8-<---- snip
> 
> Thanks for narrowing it down, do you have any patch fixing this?

I'm having some success with the following change although I'm a long 
way from completing tests of all possible permutations. It's a bit 'raw' 
and could be caught out:

diff --git a/tools/scripts/Makefile.include 
b/tools/scripts/Makefile.include
index 8abbef1..7c88242 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -2,7 +2,7 @@ ifneq ($(O),)
  ifeq ($(origin O), command line)
         dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) 
does not exist),)
         ABSOLUTE_O := $(shell cd $(O) ; pwd)
-       OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/)
+       OUTPUT := $(ABSOLUTE_O)/$(if $(filter 
%$(subdir),$(ABSOLUTE_O)),,$(subdir)/)
         COMMAND_O := O=$(ABSOLUTE_O)
  ifeq ($(objtree),)
         objtree := $(O)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: Bug 116411: tools/perf_clean: output directory does not exist. Stop.
@ 2016-04-15 20:06 TJ
  0 siblings, 0 replies; 3+ messages in thread
From: TJ @ 2016-04-15 20:06 UTC (permalink / raw)
  To: linux-kernel

Thanks for looking at this; I've become lost in Makefile hell trying to 
figure it out :)

On 15-04-2016 17:00, Arnaldo Carvalho de Melo wrote:
> Em Fri, Apr 15, 2016 at 03:21:35PM +0100, TJ escreveu:
>> v4.6-rc3
>> tools/perf then tools/perf_clean fails in the source tree:
>> *** output directory
>> "/home/all/SourceCode/linux/linux/tools/perf/tools/perf/" does not 
>> exist.
>> Stop.
>> https://bugzilla.kernel.org/show_bug.cgi?id=116411

----8-<---- snip

> I can reproduce the:
> [acme@jouet linux]$ rm -rf ../build/perf
>   [acme@jouet linux]$ mkdir ../build/perf
>   [acme@jouet linux]$ make O=../build/perf -C tools/perf
>   make: Entering directory '/home/acme/git/linux/tools/perf'
>     BUILD:   Doing 'make -j4' parallel build
>   ../scripts/Makefile.include:3: ***
> O=/home/acme/git/linux/tools/build/perf does not exist.  Stop.

----8-<---- snip
>> git blame shows commits c883122a and bf35182f are responsible for the 
>> path
>> calculation code.
> Thanks for narrowing it down, do you have any patch fixing this?

Over the last week I've exhaustively tried several alternative 
approaches, based around the idea of capturing the initial launch 
command-line O= value (since changing that for sub-makes is the problem 
here), but I've not been able to come up with a solution that works for 
all cases (srctree {relative,absolute} path or objtree 
{relative,absolute} path).

I'm also basing the command-line on the help from ./tools/Makefile 
which recommends:

   @echo ' $$ make -C tools/ <tool>_install'

I've added extensive debugging to track the changing variables from 
./tools/scripts/Makefile.include. The most successful for most 
situations (when starting from the base ./Makefile) captures BASE_O and 
then uses it for creating all paths, but the various subtle interactions 
of $(subdir) and the sub-makes, $(objtree), and others causes 
regressions such as generating output to the wrong directory.

diff --git a/tools/scripts/Makefile.include 
b/tools/scripts/Makefile.include
index 8abbef1..871c183 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -1,7 +1,11 @@
  ifneq ($(O),)
  ifeq ($(origin O), command line)
-       dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) 
does not exist),)
-       ABSOLUTE_O := $(shell cd $(O) ; pwd)
+ifeq ($(BASE_O),)
+       export BASE_O := $(abspath $(if $(filter ..% 
.%,$(O)),$(srctree)/$(O),$(O)))
+endif
+  __T := $(info BASE_O=$(BASE_O))
+       dummy := $(if $(shell test -d $(BASE_O) || echo 
$(BASE_O)),$(error BASE_O=$(BASE_O) does not exist),)
+       ABSOLUTE_O := $(shell cd $(BASE_O) ; pwd)
         OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/)
         COMMAND_O := O=$(ABSOLUTE_O)
  ifeq ($(objtree),)


Basing paths on BASE_O will fail (with incorrect paths) when starting 
the build directly with -C ./tools/ or  -C ./tools/perf/ -  it has felt 
like playing whack-a -mole!

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Bug 116411: tools/perf_clean: output directory does not exist. Stop.
@ 2016-04-15 20:05 TJ
  0 siblings, 0 replies; 3+ messages in thread
From: TJ @ 2016-04-15 20:05 UTC (permalink / raw)
  To: linux-kernel

v4.6-rc3

tools/perf then tools/perf_clean fails in the source tree:

*** output directory 
"/home/all/SourceCode/linux/linux/tools/perf/tools/perf/" does not 
exist.  Stop.

https://bugzilla.kernel.org/show_bug.cgi?id=116411

The problem is that recursive/sub-makes effectively doing 
O=$(O)/$(subdir) is changing the base directory resulting in 
$(O)/$(subdir)/$(subdir)/ : "tools/perf" "/" "tools/perf" "/". This is 
done in tools/scripts/Makefile.include:

   OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/)

This is another symptom of the bug I reported to the mailing-list and 
bugzilla on Sun, 10 Apr 2016 22:36:14 +0100, which said:

Trying to do an out-of-tree build using either absolute or relative 
paths for O= fails when trying to build tools/perf.

More details in ""Directory does not exist" when doing tools 
perf_install out-of-tree build"

https://bugzilla.kernel.org/show_bug.cgi?id=116131

git blame shows commits c883122a and bf35182f are responsible for the 
path calculation code.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-17  0:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <9e79969b0c42c9a9454a8838451945ce@iam.tj>
     [not found] ` <20160415160002.GP9056@kernel.org>
2016-04-17  0:31   ` Bug 116411: tools/perf_clean: output directory does not exist. Stop TJ
2016-04-15 20:06 TJ
  -- strict thread matches above, loose matches on Subject: below --
2016-04-15 20:05 TJ

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).