Bug 116411

Summary: tools/perf_clean: output directory XXX does not exist. Stop.
Product: Tracing/Profiling Reporter: TJ (linux)
Component: Perf toolAssignee: Arnaldo Carvalho de Melo (acme)
Status: NEW ---    
Severity: normal CC: jolsa, jolsa, translationservicespk
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: v4.6-rc3 Subsystem:
Regression: No Bisected commit-id:
Attachments: perf tools: Force subdir to be empty
tools build: Fix perf_clean target

Description TJ 2016-04-15 14:09:02 UTC
Building and then immediately cleaning in the source tree fails. Using 'remake' for extended debug info. This looks to be caused by the same issue as I reported last week in bug #116131 which affects building out-of-tree.

$ pwd
/home/all/SourceCode/linux/linux

$ gitlog -n 1
806fdcc 2016-04-14 19:53:46 -0700 N Linus Torvalds Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

$ remake JOBS=1 V=1 tools/perf
...

$ remake JOBS=1 V=1 tools/perf_clean
...
#0  silentoldconfig at /home/all/SourceCode/linux/linux/Makefile:537
Command-line invocation:
        "remake -f ./Makefile silentoldconfig"
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
mkdir -p ./tools
##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
remake LDFLAGS= MAKEFLAGS="" O=/home/all/SourceCode/linux/linux subdir=tools -C ./tools/ perf_clean
##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
mkdir -p /home/all/SourceCode/linux/linux/tools/perf && remake O=/home/all/SourceCode/linux/linux subdir=tools/perf --no-print-directory -C perf clean
##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
remake -C /home/all/SourceCode/linux/linux/tools/lib/traceevent/ O=/home/all/SourceCode/linux/linux/tools/perf/ clean >/dev/null
##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
/bin/sh: 1: cd: can't cd to /home/all/SourceCode/linux/linux/tools/perf/tools/perf/
../../scripts/Makefile.include:16: *** output directory "/home/all/SourceCode/linux/linux/tools/perf/tools/perf/" does not exist.  Stop.
Makefile.perf:450: *** [/home/all/SourceCode/linux/linux/tools/perf/libtraceevent.a-clean] Error 2

#0  /home/all/SourceCode/linux/linux/tools/perf/libtraceevent.a-clean at /home/all/SourceCode/linux/linux/tools/perf/Makefile.perf:450
#1  clean at /home/all/SourceCode/linux/linux/tools/perf/Makefile.perf:628
Command-line invocation:
        "remake -f Makefile.perf --no-print-directory -j1 O=/home/all/SourceCode/linux/linux clean"
Makefile:88: *** [clean] Error 2

#0  clean at /home/all/SourceCode/linux/linux/tools/perf/Makefile:88
Command-line invocation:
        "remake O=/home/all/SourceCode/linux/linux subdir=tools/perf --no-print-directory -C perf clean"
Makefile:139: *** [perf_clean] Error 2

#0  perf_clean at /home/all/SourceCode/linux/linux/tools/Makefile:139
Command-line invocation:
        "remake LDFLAGS= MAKEFLAGS= O=/home/all/SourceCode/linux/linux subdir=tools -C ./tools/ perf_clean"
Makefile:1547: *** [tools/perf_clean] Error 2

#0  tools/perf_clean at /home/all/SourceCode/linux/linux/Makefile:1547
Command-line invocation:
        "remake JOBS=1 V=1 tools/perf_clean"
Comment 1 Jiri Olsa 2016-04-17 13:38:58 UTC
Created attachment 213171 [details]
perf tools: Force subdir to be empty

could you please test this patch, thanks
Comment 2 TJ 2016-04-17 14:04:26 UTC
Doesn't look good; many of the paths being generated are not correct, in that the base $(O) directory is being used, not $(O)/$(subdir)/

Seeing this clearly with a:

remake V=1 JOBS=1 O=../builds/amd64 tools/perf_clean

where towards the end it does:

...
remake O=/home/all/SourceCode/linux/builds/amd64 -C Documentation  clean
##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
rm -f /home/all/SourceCode/linux/builds/amd64/perf-diff.xml /home/all/SourceCode/linux/builds/amd64/perf-record.xml /home/all/SourceCode/linux/builds/amd64/pe
rf-timechart.xml /home/all/SourceCode/linux/builds/amd64/perf-report.xml /home/all/SourceCode/linux/builds/amd64/perf-kvm.xml /home/all/SourceCode/linux/build
s/amd64/perf-data.xml /home/all/SourceCode/linux/builds/amd64/perf-buildid-cache.xml /home/all/SourceCode/linux/builds/amd64/perf-list.xml ...

Those paths should be /home/all/SourceCode/linux/builds/amd64/tools/perf/Documentation/
Comment 3 Jiri Olsa 2016-04-18 14:31:37 UTC
Created attachment 213251 [details]
tools build: Fix perf_clean target

how about this one.. thanks