diff mbox series

[v9,07/14] kernel: Disable ccache when kernel rust support is enabled

Message ID 20260313155920.2347101-8-Harish.Sadineni@windriver.com
State Accepted, archived
Commit d80d006ae85172eb5125b7e1b44d4dee48615c92
Headers show
Series Enable rust support for linux kernel | expand

Commit Message

Harish Sadineni March 13, 2026, 3:59 p.m. UTC
From: Harish Sadineni <Harish.Sadineni@windriver.com>

Currently, a ccache enabled build fails with:
  |   HOSTRUSTC scripts/generate_rust_target
  |   HOSTCC  scripts/kallsyms
  |   HOSTCC  scripts/sorttable
  |   HOSTCC  scripts/asn1_compiler
  |   TOUCH   include/generated/gcc-plugins.h
  |   DESCEND objtool
  | error: multiple input filenames provided (first two filenames are gcc and
.../tmp/work-shared/qemux86-64/kernel-source/scripts/generate_rust_target.rs)

Linux rust build infrastructure does not currently support ccache (Opened bug[0]).

Quick summary: There are 2 issues: $HOSTCC is not escaped and rustc
expect a path (and not a command)

Disable ccache if KERNEL_RUST_SUPPORT is 'True' for kernel and kernel module builds, including
auxiliary tooling such as make-mod-scripts.

More details in: https://lists.openembedded.org/g/openembedded-core/message/229336

[0]: https://github.com/Rust-for-Linux/linux/issues/1224

Co-developed-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: El Mehdi YOUNES <elmehdi.younes@smile.fr>
Cc: Alban MOIZAN <alban.moizan@smile.fr>
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/classes-recipe/kernel-yocto-rust.bbclass              | 7 +++++++
 .../make-mod-scripts/make-mod-scripts_1.0.bb               | 7 +++++++
 2 files changed, 14 insertions(+)

Comments

Richard Purdie March 14, 2026, 9:38 a.m. UTC | #1
On Fri, 2026-03-13 at 08:59 -0700, Harish.Sadineni@windriver.com wrote:
> From: Harish Sadineni <Harish.Sadineni@windriver.com>
> 
> Currently, a ccache enabled build fails with:
>   |   HOSTRUSTC scripts/generate_rust_target
>   |   HOSTCC  scripts/kallsyms
>   |   HOSTCC  scripts/sorttable
>   |   HOSTCC  scripts/asn1_compiler
>   |   TOUCH   include/generated/gcc-plugins.h
>   |   DESCEND objtool
>   | error: multiple input filenames provided (first two filenames are gcc and
> .../tmp/work-shared/qemux86-64/kernel-source/scripts/generate_rust_target.rs)
> 
> Linux rust build infrastructure does not currently support ccache (Opened bug[0]).
> 
> Quick summary: There are 2 issues: $HOSTCC is not escaped and rustc
> expect a path (and not a command)
> 
> Disable ccache if KERNEL_RUST_SUPPORT is 'True' for kernel and kernel module builds, including
> auxiliary tooling such as make-mod-scripts.
> 
> More details in: https://lists.openembedded.org/g/openembedded-core/message/229336
> 
> [0]: https://github.com/Rust-for-Linux/linux/issues/1224
> 
> Co-developed-by: Yoann Congal <yoann.congal@smile.fr>
> Signed-off-by: El Mehdi YOUNES <elmehdi.younes@smile.fr>
> Cc: Alban MOIZAN <alban.moizan@smile.fr>
> Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
> ---
>  meta/classes-recipe/kernel-yocto-rust.bbclass              | 7 +++++++
>  .../make-mod-scripts/make-mod-scripts_1.0.bb               | 7 +++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/meta/classes-recipe/kernel-yocto-rust.bbclass b/meta/classes-recipe/kernel-yocto-rust.bbclass
> index fd9ee91c79..608ccc4609 100644
> --- a/meta/classes-recipe/kernel-yocto-rust.bbclass
> +++ b/meta/classes-recipe/kernel-yocto-rust.bbclass
> @@ -16,3 +16,10 @@ do_kernel_configme[depends] += "${RUST_KERNEL_TASK_DEPENDS}"
>  do_kernel_configme:append () {
>          oe_runmake -C ${S} O=${B} rustavailable
>  }
> +
> +# Linux rust build infrastructure does not currently support ccache
> +# see https://github.com/Rust-for-Linux/linux/issues/1224
> +# Quick summary: There are 2 issues: $HOSTCC is not escaped and rustc expect a path (and not a command)
> +# More details in: https://lists.openembedded.org/g/openembedded-core/message/229336
> +# Disable ccache for kernel build if kernel rust support is enabled to workaround this.
> +CCACHE_DISABLE ?= "1"
> diff --git a/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb b/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb
> index 874e16e642..5fbc5c2154 100644
> --- a/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb
> +++ b/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb
> @@ -36,3 +36,10 @@ do_configure() {
>  		-C ${STAGING_KERNEL_DIR} O=${STAGING_KERNEL_BUILDDIR} $t
>  	done
>  }
> +
> +# Linux rust build infrastructure does not currently support ccache
> +# see https://github.com/Rust-for-Linux/linux/issues/1224
> +# Quick summary: There are 2 issues: $HOSTCC is not escaped and rustc expect a path (and not a command)
> +# More details in: https://lists.openembedded.org/g/openembedded-core/message/229336
> +# Disable ccache for kernel build if kernel rust support is enabled to workaround this
> +CCACHE_DISABLE ?= "{@bb.utils.contains('KERNEL_FEATURES', 'rust', "1", "0", d)}"

This fails to run, it is missing a '$'. No need to resend, I've fixed
in what I'm testing on master-next.

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel-yocto-rust.bbclass b/meta/classes-recipe/kernel-yocto-rust.bbclass
index fd9ee91c79..608ccc4609 100644
--- a/meta/classes-recipe/kernel-yocto-rust.bbclass
+++ b/meta/classes-recipe/kernel-yocto-rust.bbclass
@@ -16,3 +16,10 @@  do_kernel_configme[depends] += "${RUST_KERNEL_TASK_DEPENDS}"
 do_kernel_configme:append () {
         oe_runmake -C ${S} O=${B} rustavailable
 }
+
+# Linux rust build infrastructure does not currently support ccache
+# see https://github.com/Rust-for-Linux/linux/issues/1224
+# Quick summary: There are 2 issues: $HOSTCC is not escaped and rustc expect a path (and not a command)
+# More details in: https://lists.openembedded.org/g/openembedded-core/message/229336
+# Disable ccache for kernel build if kernel rust support is enabled to workaround this.
+CCACHE_DISABLE ?= "1"
diff --git a/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb b/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb
index 874e16e642..5fbc5c2154 100644
--- a/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb
+++ b/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb
@@ -36,3 +36,10 @@  do_configure() {
 		-C ${STAGING_KERNEL_DIR} O=${STAGING_KERNEL_BUILDDIR} $t
 	done
 }
+
+# Linux rust build infrastructure does not currently support ccache
+# see https://github.com/Rust-for-Linux/linux/issues/1224
+# Quick summary: There are 2 issues: $HOSTCC is not escaped and rustc expect a path (and not a command)
+# More details in: https://lists.openembedded.org/g/openembedded-core/message/229336
+# Disable ccache for kernel build if kernel rust support is enabled to workaround this
+CCACHE_DISABLE ?= "{@bb.utils.contains('KERNEL_FEATURES', 'rust', "1", "0", d)}"