* [PATCH v2] perf: Fix clean error
@ 2018-09-03 2:50 Lei YU
2018-09-03 4:49 ` Lei YU
0 siblings, 1 reply; 2+ messages in thread
From: Lei YU @ 2018-09-03 2:50 UTC (permalink / raw)
To: Philippe Ombredanne, Kate Stewart, Laura Abbott, Masahiro Yamada,
Thomas Gleixner, Greg Kroah-Hartman, Lei YU, linux-kernel,
Joel Stanley
When make perf with -O, it gets error when make clean with below log:
$ make -C tools/perf O=<output/dir> # OK
$ make -C tools/perf O=<output/dir> clean # Got below error
find: cannot delete ‘<output/dir>/builtin-script.o’: No such file or directory
find: cannot delete ‘<output/dir>/.subcmd-config.o.cmd’: No such file or directory
...
Makefile:38: recipe for target 'clean' failed
make[2]: *** [clean] Error 1
make[1]: *** [fixdep-clean] Error 2
Makefile:90: recipe for target 'clean' failed
make: *** [clean] Error 2
It happens because both fixdep-clean and libsubcmd-clean will delete
files by `find`, where libsubcmd-clean uses `| xargs $(RM)` and
fixdep-clean uses `-delete`.
When a file is find by fixdep-clean, and tries to delete it, it's found
that the file does not exist because it is deleted by libsubcmd-clean.
This commit changes the delete method of fixdep-clean to use
`| xargs $(RM)` as well, where RM is defined as `rm -f` so it does not
return error when file does not exist.
Signed-off-by: Lei YU <mine260309@gmail.com>
---
v2: Fix missing "make clean" in commit message
---
tools/build/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/build/Makefile b/tools/build/Makefile
index 5edf65e..ae38db2 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -18,6 +18,7 @@ $(call allow-override,LD,$(CROSS_COMPILE)ld)
HOSTCC ?= gcc
HOSTLD ?= ld
HOSTAR ?= ar
+RM = rm -f
export HOSTCC HOSTLD HOSTAR
@@ -36,7 +37,7 @@ all: $(OUTPUT)fixdep
clean:
$(call QUIET_CLEAN, fixdep)
- $(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
+ $(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -o -name '\.*.cmd' -o -name '\.*.d' | xargs $(RM)
$(Q)rm -f $(OUTPUT)fixdep
$(OUTPUT)fixdep-in.o: FORCE
--
2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] perf: Fix clean error
2018-09-03 2:50 [PATCH v2] perf: Fix clean error Lei YU
@ 2018-09-03 4:49 ` Lei YU
0 siblings, 0 replies; 2+ messages in thread
From: Lei YU @ 2018-09-03 4:49 UTC (permalink / raw)
To: Philippe Ombredanne, Kate Stewart, Laura Abbott, Masahiro Yamada,
Thomas Gleixner, Greg Kroah-Hartman, Linux Kernel Mailing List,
Joel Stanley
Just find out that da15fc2fa9c07b23db8f5e479bd8a9f0d741ca07 (introduced in
v4.19-rc1) already fixes the issue by specifying -j1 on make clean.
So this commit is not needed anymore, though I think it does fix the root
cause.
But if we do want parallel clean, we could revert that and merge this commit.
On Mon, Sep 3, 2018 at 10:50 AM Lei YU <mine260309@gmail.com> wrote:
>
> When make perf with -O, it gets error when make clean with below log:
>
> $ make -C tools/perf O=<output/dir> # OK
> $ make -C tools/perf O=<output/dir> clean # Got below error
>
> find: cannot delete ‘<output/dir>/builtin-script.o’: No such file or directory
> find: cannot delete ‘<output/dir>/.subcmd-config.o.cmd’: No such file or directory
> ...
> Makefile:38: recipe for target 'clean' failed
> make[2]: *** [clean] Error 1
> make[1]: *** [fixdep-clean] Error 2
> Makefile:90: recipe for target 'clean' failed
> make: *** [clean] Error 2
>
> It happens because both fixdep-clean and libsubcmd-clean will delete
> files by `find`, where libsubcmd-clean uses `| xargs $(RM)` and
> fixdep-clean uses `-delete`.
> When a file is find by fixdep-clean, and tries to delete it, it's found
> that the file does not exist because it is deleted by libsubcmd-clean.
>
> This commit changes the delete method of fixdep-clean to use
> `| xargs $(RM)` as well, where RM is defined as `rm -f` so it does not
> return error when file does not exist.
>
> Signed-off-by: Lei YU <mine260309@gmail.com>
>
> ---
> v2: Fix missing "make clean" in commit message
> ---
> tools/build/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/build/Makefile b/tools/build/Makefile
> index 5edf65e..ae38db2 100644
> --- a/tools/build/Makefile
> +++ b/tools/build/Makefile
> @@ -18,6 +18,7 @@ $(call allow-override,LD,$(CROSS_COMPILE)ld)
> HOSTCC ?= gcc
> HOSTLD ?= ld
> HOSTAR ?= ar
> +RM = rm -f
>
> export HOSTCC HOSTLD HOSTAR
>
> @@ -36,7 +37,7 @@ all: $(OUTPUT)fixdep
>
> clean:
> $(call QUIET_CLEAN, fixdep)
> - $(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
> + $(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -o -name '\.*.cmd' -o -name '\.*.d' | xargs $(RM)
> $(Q)rm -f $(OUTPUT)fixdep
>
> $(OUTPUT)fixdep-in.o: FORCE
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-03 4:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-03 2:50 [PATCH v2] perf: Fix clean error Lei YU
2018-09-03 4:49 ` Lei YU
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®