linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools/power/acpi: Fix the compile error when output directory is specified
@ 2021-11-23 13:23 Chen Yu
  2021-11-23 13:53 ` Andy Shevchenko
  2021-12-08 14:12 ` Rafael J. Wysocki
  0 siblings, 2 replies; 4+ messages in thread
From: Chen Yu @ 2021-11-23 13:23 UTC (permalink / raw)
  To: linux-acpi
  Cc: Robert Moore, Rafael J. Wysocki, Len Brown, devel, linux-kernel,
	Andy Shevchenko, Chen Yu

Compiling the tool when output directory parameter is specified would
trigger the following error:

make O=/data/test/tmp/ -C tools/power/acpi/

make: Entering directory '/data/src/kernel/linux/tools/power/acpi'
  DESCEND tools/acpidbg
make[1]: Entering directory '/data/src/kernel/linux/tools/power/acpi/tools/acpidbg'
  MKDIR    include
  CP       include
  CC       tools/acpidbg/acpidbg.o
Assembler messages:
Fatal error: can't create /data/test/tmp/tools/power/acpi/tools/acpidbg/acpidbg.o: No such file or directory
make[1]: *** [../../Makefile.rules:24: /data/test/tmp/tools/power/acpi/tools/acpidbg/acpidbg.o] Error 1
make[1]: Leaving directory '/data/src/kernel/linux/tools/power/acpi/tools/acpidbg'
make: *** [Makefile:18: acpidbg] Error 2
make: Leaving directory '/data/src/kernel/linux/tools/power/acpi'

This is because the output directory has not been created yet. Fix this issue by
creating the output directory before compiling.

Reported-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
---
 tools/power/acpi/Makefile.config | 1 +
 tools/power/acpi/Makefile.rules  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/tools/power/acpi/Makefile.config b/tools/power/acpi/Makefile.config
index 331f6d30f472..cd7106876a5f 100644
--- a/tools/power/acpi/Makefile.config
+++ b/tools/power/acpi/Makefile.config
@@ -69,6 +69,7 @@ KERNEL_INCLUDE := $(OUTPUT)include
 ACPICA_INCLUDE := $(srctree)/../../../drivers/acpi/acpica
 CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE)
 CFLAGS += $(WARNINGS)
+MKDIR = mkdir
 
 ifeq ($(strip $(V)),false)
 	QUIET=@
diff --git a/tools/power/acpi/Makefile.rules b/tools/power/acpi/Makefile.rules
index 2a6c170b57cd..1d7616f5d0ae 100644
--- a/tools/power/acpi/Makefile.rules
+++ b/tools/power/acpi/Makefile.rules
@@ -21,6 +21,7 @@ $(KERNEL_INCLUDE):
 
 $(objdir)%.o: %.c $(KERNEL_INCLUDE)
 	$(ECHO) "  CC      " $(subst $(OUTPUT),,$@)
+	$(QUIET) $(MKDIR) -p $(objdir) 2>/dev/null
 	$(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
 
 all: $(OUTPUT)$(TOOL)
-- 
2.25.1


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

* Re: [PATCH] tools/power/acpi: Fix the compile error when output directory is specified
  2021-11-23 13:23 [PATCH] tools/power/acpi: Fix the compile error when output directory is specified Chen Yu
@ 2021-11-23 13:53 ` Andy Shevchenko
  2021-11-23 17:03   ` Chen Yu
  2021-12-08 14:12 ` Rafael J. Wysocki
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2021-11-23 13:53 UTC (permalink / raw)
  To: Chen Yu
  Cc: linux-acpi, Robert Moore, Rafael J. Wysocki, Len Brown, devel,
	linux-kernel

On Tue, Nov 23, 2021 at 09:23:30PM +0800, Chen Yu wrote:
> Compiling the tool when output directory parameter is specified would
> trigger the following error:
> 
> make O=/data/test/tmp/ -C tools/power/acpi/
> 
> make: Entering directory '/data/src/kernel/linux/tools/power/acpi'
>   DESCEND tools/acpidbg
> make[1]: Entering directory '/data/src/kernel/linux/tools/power/acpi/tools/acpidbg'
>   MKDIR    include
>   CP       include
>   CC       tools/acpidbg/acpidbg.o
> Assembler messages:
> Fatal error: can't create /data/test/tmp/tools/power/acpi/tools/acpidbg/acpidbg.o: No such file or directory
> make[1]: *** [../../Makefile.rules:24: /data/test/tmp/tools/power/acpi/tools/acpidbg/acpidbg.o] Error 1
> make[1]: Leaving directory '/data/src/kernel/linux/tools/power/acpi/tools/acpidbg'
> make: *** [Makefile:18: acpidbg] Error 2
> make: Leaving directory '/data/src/kernel/linux/tools/power/acpi'
> 
> This is because the output directory has not been created yet. Fix this issue by
> creating the output directory before compiling.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Thanks!

> Reported-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> ---
>  tools/power/acpi/Makefile.config | 1 +
>  tools/power/acpi/Makefile.rules  | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/tools/power/acpi/Makefile.config b/tools/power/acpi/Makefile.config
> index 331f6d30f472..cd7106876a5f 100644
> --- a/tools/power/acpi/Makefile.config
> +++ b/tools/power/acpi/Makefile.config
> @@ -69,6 +69,7 @@ KERNEL_INCLUDE := $(OUTPUT)include
>  ACPICA_INCLUDE := $(srctree)/../../../drivers/acpi/acpica
>  CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE)
>  CFLAGS += $(WARNINGS)
> +MKDIR = mkdir
>  
>  ifeq ($(strip $(V)),false)
>  	QUIET=@
> diff --git a/tools/power/acpi/Makefile.rules b/tools/power/acpi/Makefile.rules
> index 2a6c170b57cd..1d7616f5d0ae 100644
> --- a/tools/power/acpi/Makefile.rules
> +++ b/tools/power/acpi/Makefile.rules
> @@ -21,6 +21,7 @@ $(KERNEL_INCLUDE):
>  
>  $(objdir)%.o: %.c $(KERNEL_INCLUDE)
>  	$(ECHO) "  CC      " $(subst $(OUTPUT),,$@)
> +	$(QUIET) $(MKDIR) -p $(objdir) 2>/dev/null

Not sure we need the `2>/dev/null` part.

>  	$(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
>  
>  all: $(OUTPUT)$(TOOL)
> -- 
> 2.25.1
> 

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] tools/power/acpi: Fix the compile error when output directory is specified
  2021-11-23 13:53 ` Andy Shevchenko
@ 2021-11-23 17:03   ` Chen Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chen Yu @ 2021-11-23 17:03 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-acpi, Robert Moore, Rafael J. Wysocki, Len Brown, devel,
	linux-kernel

On Tue, Nov 23, 2021 at 03:53:07PM +0200, Andy Shevchenko wrote:
> On Tue, Nov 23, 2021 at 09:23:30PM +0800, Chen Yu wrote:
> > Compiling the tool when output directory parameter is specified would
> > trigger the following error:
> > 
> > make O=/data/test/tmp/ -C tools/power/acpi/
> > 
> > make: Entering directory '/data/src/kernel/linux/tools/power/acpi'
> >   DESCEND tools/acpidbg
> > make[1]: Entering directory '/data/src/kernel/linux/tools/power/acpi/tools/acpidbg'
> >   MKDIR    include
> >   CP       include
> >   CC       tools/acpidbg/acpidbg.o
> > Assembler messages:
> > Fatal error: can't create /data/test/tmp/tools/power/acpi/tools/acpidbg/acpidbg.o: No such file or directory
> > make[1]: *** [../../Makefile.rules:24: /data/test/tmp/tools/power/acpi/tools/acpidbg/acpidbg.o] Error 1
> > make[1]: Leaving directory '/data/src/kernel/linux/tools/power/acpi/tools/acpidbg'
> > make: *** [Makefile:18: acpidbg] Error 2
> > make: Leaving directory '/data/src/kernel/linux/tools/power/acpi'
> > 
> > This is because the output directory has not been created yet. Fix this issue by
> > creating the output directory before compiling.
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Thanks!
>
Thanks for review. 
> >  
> >  $(objdir)%.o: %.c $(KERNEL_INCLUDE)
> >  	$(ECHO) "  CC      " $(subst $(OUTPUT),,$@)
> > +	$(QUIET) $(MKDIR) -p $(objdir) 2>/dev/null
> 
> Not sure we need the `2>/dev/null` part.
> 
If the 'O=' is a read-only directory, mkdir would print errors
and adding 2> would avoid printing it. So the user could focus
on the real compile error.

without '2>'  :
make O=/data/test/tmp -C tools/power/acpi/
make: Entering directory '/data/src/kernel/linux/tools/power/acpi'
  DESCEND tools/acpidbg
mkdir: cannot create directory ‘/data/test/tmp/tools’: Permission denied


thanks,
Chenyu
> >  	$(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
> >  
> >  all: $(OUTPUT)$(TOOL)
> > -- 
> > 2.25.1
> > 
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

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

* Re: [PATCH] tools/power/acpi: Fix the compile error when output directory is specified
  2021-11-23 13:23 [PATCH] tools/power/acpi: Fix the compile error when output directory is specified Chen Yu
  2021-11-23 13:53 ` Andy Shevchenko
@ 2021-12-08 14:12 ` Rafael J. Wysocki
  1 sibling, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2021-12-08 14:12 UTC (permalink / raw)
  To: Chen Yu
  Cc: ACPI Devel Maling List, Robert Moore, Rafael J. Wysocki,
	Len Brown, open list:ACPI COMPONENT ARCHITECTURE (ACPICA),
	Linux Kernel Mailing List, Andy Shevchenko

On Tue, Nov 23, 2021 at 2:24 PM Chen Yu <yu.c.chen@intel.com> wrote:
>
> Compiling the tool when output directory parameter is specified would
> trigger the following error:
>
> make O=/data/test/tmp/ -C tools/power/acpi/
>
> make: Entering directory '/data/src/kernel/linux/tools/power/acpi'
>   DESCEND tools/acpidbg
> make[1]: Entering directory '/data/src/kernel/linux/tools/power/acpi/tools/acpidbg'
>   MKDIR    include
>   CP       include
>   CC       tools/acpidbg/acpidbg.o
> Assembler messages:
> Fatal error: can't create /data/test/tmp/tools/power/acpi/tools/acpidbg/acpidbg.o: No such file or directory
> make[1]: *** [../../Makefile.rules:24: /data/test/tmp/tools/power/acpi/tools/acpidbg/acpidbg.o] Error 1
> make[1]: Leaving directory '/data/src/kernel/linux/tools/power/acpi/tools/acpidbg'
> make: *** [Makefile:18: acpidbg] Error 2
> make: Leaving directory '/data/src/kernel/linux/tools/power/acpi'
>
> This is because the output directory has not been created yet. Fix this issue by
> creating the output directory before compiling.
>
> Reported-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> ---
>  tools/power/acpi/Makefile.config | 1 +
>  tools/power/acpi/Makefile.rules  | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/tools/power/acpi/Makefile.config b/tools/power/acpi/Makefile.config
> index 331f6d30f472..cd7106876a5f 100644
> --- a/tools/power/acpi/Makefile.config
> +++ b/tools/power/acpi/Makefile.config
> @@ -69,6 +69,7 @@ KERNEL_INCLUDE := $(OUTPUT)include
>  ACPICA_INCLUDE := $(srctree)/../../../drivers/acpi/acpica
>  CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE)
>  CFLAGS += $(WARNINGS)
> +MKDIR = mkdir
>
>  ifeq ($(strip $(V)),false)
>         QUIET=@
> diff --git a/tools/power/acpi/Makefile.rules b/tools/power/acpi/Makefile.rules
> index 2a6c170b57cd..1d7616f5d0ae 100644
> --- a/tools/power/acpi/Makefile.rules
> +++ b/tools/power/acpi/Makefile.rules
> @@ -21,6 +21,7 @@ $(KERNEL_INCLUDE):
>
>  $(objdir)%.o: %.c $(KERNEL_INCLUDE)
>         $(ECHO) "  CC      " $(subst $(OUTPUT),,$@)
> +       $(QUIET) $(MKDIR) -p $(objdir) 2>/dev/null
>         $(QUIET) $(CC) -c $(CFLAGS) -o $@ $<
>
>  all: $(OUTPUT)$(TOOL)
> --

Applied (with some edits in the subject and changelog) as 5.16-rc material.

Thanks!

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

end of thread, other threads:[~2021-12-08 14:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23 13:23 [PATCH] tools/power/acpi: Fix the compile error when output directory is specified Chen Yu
2021-11-23 13:53 ` Andy Shevchenko
2021-11-23 17:03   ` Chen Yu
2021-12-08 14:12 ` Rafael J. Wysocki

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