linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] kbuild: install-extmod-build: Properly fix CC expansion when ccache is used
@ 2025-11-11  6:43 Abel Vesa
  2025-11-11 13:03 ` Nicolas Schier
  2025-11-12  5:36 ` Nathan Chancellor
  0 siblings, 2 replies; 5+ messages in thread
From: Abel Vesa @ 2025-11-11  6:43 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Masahiro Yamada
  Cc: Jeff Johnson, linux-kbuild, linux-kernel, Abel Vesa

Currently, when cross-compiling and ccache is used, the expanding of CC
turns out to be without any quotes, leading to the following error:

make[4]: *** No rule to make target 'aarch64-linux-gnu-gcc'.  Stop.
make[3]: *** [Makefile:2164: run-command] Error 2

And it makes sense, because after expansion it ends up like this:

make run-command KBUILD_RUN_COMMAND=+$(MAKE) \
HOSTCC=ccache aarch64-linux-gnu-gcc VPATH= srcroot=. $(build)= ...

So add another set of double quotes to surround whatever CC expands to
to make sure the aarch64-linux-gnu-gcc isn't expanded to something that
looks like an entirely separate target.

Fixes: 140332b6ed72 ("kbuild: fix linux-headers package build when $(CC) cannot link userspace")
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
---
Changes in v2:
- Moved the new double quotes inside of single ones, to be able
  to drop the escape, like Nathan suggested.
- Re-worded the commit message according to the above change.
- Link to v1: https://lore.kernel.org/r/20251110-kbuild-install-extmod-build-fix-cc-expand-third-try-v1-1-5c0ddb1c67a8@linaro.org
---
 scripts/package/install-extmod-build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/package/install-extmod-build b/scripts/package/install-extmod-build
index 054fdf45cc37a8717444b8094daf3e1150a8ccf5..2576cf7902dbbfcd82ea690aac1b2a246b3a6a30 100755
--- a/scripts/package/install-extmod-build
+++ b/scripts/package/install-extmod-build
@@ -63,7 +63,7 @@ if [ "${CC}" != "${HOSTCC}" ]; then
 	# Clear VPATH and srcroot because the source files reside in the output
 	# directory.
 	# shellcheck disable=SC2016 # $(MAKE) and $(build) will be expanded by Make
-	"${MAKE}" run-command KBUILD_RUN_COMMAND='+$(MAKE) HOSTCC='"${CC}"' VPATH= srcroot=. $(build)='"$(realpath --relative-to=. "${destdir}")"/scripts
+	"${MAKE}" run-command KBUILD_RUN_COMMAND='+$(MAKE) HOSTCC="'"${CC}"'" VPATH= srcroot=. $(build)='"$(realpath --relative-to=. "${destdir}")"/scripts
 
 	rm -f "${destdir}/scripts/Kbuild"
 fi

---
base-commit: 9c0826a5d9aa4d52206dd89976858457a2a8a7ed
change-id: 20251109-kbuild-install-extmod-build-fix-cc-expand-third-try-2cb1540cadbf

Best regards,
-- 
Abel Vesa <abel.vesa@linaro.org>


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

* Re: [PATCH v2] kbuild: install-extmod-build: Properly fix CC expansion when ccache is used
  2025-11-11  6:43 [PATCH v2] kbuild: install-extmod-build: Properly fix CC expansion when ccache is used Abel Vesa
@ 2025-11-11 13:03 ` Nicolas Schier
  2025-11-11 14:28   ` Abel Vesa
  2025-11-12  5:36 ` Nathan Chancellor
  1 sibling, 1 reply; 5+ messages in thread
From: Nicolas Schier @ 2025-11-11 13:03 UTC (permalink / raw)
  To: Abel Vesa
  Cc: Nathan Chancellor, Masahiro Yamada, Jeff Johnson, linux-kbuild,
	linux-kernel

On Tue, Nov 11, 2025 at 08:43:51AM +0200, Abel Vesa wrote:
> Currently, when cross-compiling and ccache is used, the expanding of CC
> turns out to be without any quotes, leading to the following error:
> 
> make[4]: *** No rule to make target 'aarch64-linux-gnu-gcc'.  Stop.
> make[3]: *** [Makefile:2164: run-command] Error 2
> 
> And it makes sense, because after expansion it ends up like this:
> 
> make run-command KBUILD_RUN_COMMAND=+$(MAKE) \
> HOSTCC=ccache aarch64-linux-gnu-gcc VPATH= srcroot=. $(build)= ...
> 
> So add another set of double quotes to surround whatever CC expands to
> to make sure the aarch64-linux-gnu-gcc isn't expanded to something that
> looks like an entirely separate target.
> 
> Fixes: 140332b6ed72 ("kbuild: fix linux-headers package build when $(CC) cannot link userspace")
> Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
> ---
> Changes in v2:
> - Moved the new double quotes inside of single ones, to be able
>   to drop the escape, like Nathan suggested.
> - Re-worded the commit message according to the above change.
> - Link to v1: https://lore.kernel.org/r/20251110-kbuild-install-extmod-build-fix-cc-expand-third-try-v1-1-5c0ddb1c67a8@linaro.org
> ---
>  scripts/package/install-extmod-build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Just as a note: the fix is only required for build rpm packages.  For
the Debian package call of install-extmod-build
CC="${DEB_HOST_GNU_TYPE}-gcc" is used, no matter what was given to make
deb-pkg.

Reviewed-by: Nicolas Schier <nsc@kernel.org>

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

* Re: [PATCH v2] kbuild: install-extmod-build: Properly fix CC expansion when ccache is used
  2025-11-11 13:03 ` Nicolas Schier
@ 2025-11-11 14:28   ` Abel Vesa
  2025-11-11 14:33     ` Nicolas Schier
  0 siblings, 1 reply; 5+ messages in thread
From: Abel Vesa @ 2025-11-11 14:28 UTC (permalink / raw)
  To: Nicolas Schier
  Cc: Nathan Chancellor, Masahiro Yamada, Jeff Johnson, linux-kbuild,
	linux-kernel

On 25-11-11 14:03:10, Nicolas Schier wrote:
> On Tue, Nov 11, 2025 at 08:43:51AM +0200, Abel Vesa wrote:
> > Currently, when cross-compiling and ccache is used, the expanding of CC
> > turns out to be without any quotes, leading to the following error:
> > 
> > make[4]: *** No rule to make target 'aarch64-linux-gnu-gcc'.  Stop.
> > make[3]: *** [Makefile:2164: run-command] Error 2
> > 
> > And it makes sense, because after expansion it ends up like this:
> > 
> > make run-command KBUILD_RUN_COMMAND=+$(MAKE) \
> > HOSTCC=ccache aarch64-linux-gnu-gcc VPATH= srcroot=. $(build)= ...
> > 
> > So add another set of double quotes to surround whatever CC expands to
> > to make sure the aarch64-linux-gnu-gcc isn't expanded to something that
> > looks like an entirely separate target.
> > 
> > Fixes: 140332b6ed72 ("kbuild: fix linux-headers package build when $(CC) cannot link userspace")
> > Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
> > ---
> > Changes in v2:
> > - Moved the new double quotes inside of single ones, to be able
> >   to drop the escape, like Nathan suggested.
> > - Re-worded the commit message according to the above change.
> > - Link to v1: https://lore.kernel.org/r/20251110-kbuild-install-extmod-build-fix-cc-expand-third-try-v1-1-5c0ddb1c67a8@linaro.org
> > ---
> >  scripts/package/install-extmod-build | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> 
> Just as a note: the fix is only required for build rpm packages.

.. or pacman packages. Easy way to reproduce:

make ARCH=arm64 CROSS_COMPILE="aarch64-linux-gnu-" CC="ccache aarch64-linux-gnu-gcc" pacman-pkg

> For the Debian package call of install-extmod-build
> CC="${DEB_HOST_GNU_TYPE}-gcc" is used, no matter what was given to make
> deb-pkg.
> 
> Reviewed-by: Nicolas Schier <nsc@kernel.org>

Thanks.

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

* Re: [PATCH v2] kbuild: install-extmod-build: Properly fix CC expansion when ccache is used
  2025-11-11 14:28   ` Abel Vesa
@ 2025-11-11 14:33     ` Nicolas Schier
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Schier @ 2025-11-11 14:33 UTC (permalink / raw)
  To: Abel Vesa
  Cc: Nathan Chancellor, Masahiro Yamada, Jeff Johnson, linux-kbuild,
	linux-kernel

On Tue, Nov 11, 2025 at 04:28:06PM +0200, Abel Vesa wrote:
> On 25-11-11 14:03:10, Nicolas Schier wrote:
> > On Tue, Nov 11, 2025 at 08:43:51AM +0200, Abel Vesa wrote:
> > > Currently, when cross-compiling and ccache is used, the expanding of CC
> > > turns out to be without any quotes, leading to the following error:
> > > 
> > > make[4]: *** No rule to make target 'aarch64-linux-gnu-gcc'.  Stop.
> > > make[3]: *** [Makefile:2164: run-command] Error 2
> > > 
> > > And it makes sense, because after expansion it ends up like this:
> > > 
> > > make run-command KBUILD_RUN_COMMAND=+$(MAKE) \
> > > HOSTCC=ccache aarch64-linux-gnu-gcc VPATH= srcroot=. $(build)= ...
> > > 
> > > So add another set of double quotes to surround whatever CC expands to
> > > to make sure the aarch64-linux-gnu-gcc isn't expanded to something that
> > > looks like an entirely separate target.
> > > 
> > > Fixes: 140332b6ed72 ("kbuild: fix linux-headers package build when $(CC) cannot link userspace")
> > > Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
> > > ---
> > > Changes in v2:
> > > - Moved the new double quotes inside of single ones, to be able
> > >   to drop the escape, like Nathan suggested.
> > > - Re-worded the commit message according to the above change.
> > > - Link to v1: https://lore.kernel.org/r/20251110-kbuild-install-extmod-build-fix-cc-expand-third-try-v1-1-5c0ddb1c67a8@linaro.org
> > > ---
> > >  scripts/package/install-extmod-build | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > 
> > Just as a note: the fix is only required for build rpm packages.
> 
> .. or pacman packages. Easy way to reproduce:
> 
> make ARCH=arm64 CROSS_COMPILE="aarch64-linux-gnu-" CC="ccache aarch64-linux-gnu-gcc" pacman-pkg

ah sure.  Thanks!


-- 
Nicolas

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

* Re: [PATCH v2] kbuild: install-extmod-build: Properly fix CC expansion when ccache is used
  2025-11-11  6:43 [PATCH v2] kbuild: install-extmod-build: Properly fix CC expansion when ccache is used Abel Vesa
  2025-11-11 13:03 ` Nicolas Schier
@ 2025-11-12  5:36 ` Nathan Chancellor
  1 sibling, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2025-11-12  5:36 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Masahiro Yamada, Abel Vesa
  Cc: Jeff Johnson, linux-kbuild, linux-kernel

On Tue, 11 Nov 2025 08:43:51 +0200, Abel Vesa wrote:
> Currently, when cross-compiling and ccache is used, the expanding of CC
> turns out to be without any quotes, leading to the following error:
> 
> make[4]: *** No rule to make target 'aarch64-linux-gnu-gcc'.  Stop.
> make[3]: *** [Makefile:2164: run-command] Error 2
> 
> And it makes sense, because after expansion it ends up like this:
> 
> [...]

Applied to

  https://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git kbuild-fixes

Thanks!

[1/1] kbuild: install-extmod-build: Properly fix CC expansion when ccache is used
      https://git.kernel.org/kbuild/c/4ab2ee3079835

Please look out for regression or issue reports or other follow up
comments, as they may result in the patch/series getting dropped or
reverted.

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


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

end of thread, other threads:[~2025-11-12  5:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-11  6:43 [PATCH v2] kbuild: install-extmod-build: Properly fix CC expansion when ccache is used Abel Vesa
2025-11-11 13:03 ` Nicolas Schier
2025-11-11 14:28   ` Abel Vesa
2025-11-11 14:33     ` Nicolas Schier
2025-11-12  5:36 ` Nathan Chancellor

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