diff mbox series

[v5,07/15] kernel-yocto.bbclass: Disable ccache when rust-kernel is enabled

Message ID 20260129163910.2612040-8-Harish.Sadineni@windriver.com
State Changes Requested
Headers show
Series Enable rust support for linux kernel | expand

Commit Message

Harish Sadineni Jan. 29, 2026, 4:39 p.m. UTC
From: Yoann Congal <yoann.congal@smile.fr>

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)

when using ccache, value of "HOSTCC=cache gcc" when this value is passing
to rustc, It is thinking gcc is a input file. when ccache is not used "HOSTCC=gcc" is passed.

Disable ccache for kernel build if rust-kernel is enabled to workaround
this.

Signed-off-by: El Mehdi YOUNES <elmehdi.younes@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.bbclass | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Paul Barker Feb. 4, 2026, 12:05 p.m. UTC | #1
On Thu, 2026-01-29 at 08:39 -0800, Sadineni, Harish via
lists.openembedded.org wrote:
> From: Yoann Congal <yoann.congal@smile.fr>
> 
> 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)
> 
> when using ccache, value of "HOSTCC=cache gcc" when this value is passing
> to rustc, It is thinking gcc is a input file. when ccache is not used "HOSTCC=gcc" is passed.
> 
> Disable ccache for kernel build if rust-kernel is enabled to workaround
> this.
> 
> Signed-off-by: El Mehdi YOUNES <elmehdi.younes@smile.fr>
> Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>

This patch is good, but we should try to get the issue resolved upstream
if we can so that ccache can be used.

Has this been reported upstream yet? Could you also open a bug in our
bugzilla to track this?

Best regards,
Yoann Congal Feb. 4, 2026, 12:31 p.m. UTC | #2
On Wed Feb 4, 2026 at 1:05 PM CET, Paul Barker wrote:
> On Thu, 2026-01-29 at 08:39 -0800, Sadineni, Harish via
> lists.openembedded.org wrote:
>> From: Yoann Congal <yoann.congal@smile.fr>
>> 
>> 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)
>> 
>> when using ccache, value of "HOSTCC=cache gcc" when this value is passing
>> to rustc, It is thinking gcc is a input file. when ccache is not used "HOSTCC=gcc" is passed.
>> 
>> Disable ccache for kernel build if rust-kernel is enabled to workaround
>> this.
>> 
>> Signed-off-by: El Mehdi YOUNES <elmehdi.younes@smile.fr>
>> Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
>> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
>
> This patch is good, but we should try to get the issue resolved upstream
> if we can so that ccache can be used.
>
> Has this been reported upstream yet? Could you also open a bug in our
> bugzilla to track this?

Hello,

For context, a lengthy discussion happened on this patch here:
https://lore.kernel.org/openembedded-core/CA+TGqK9Yd2WWKrhMkhofF-8N0cESCSefWD2DXr4sBO9fDQXyrg@mail.gmail.com/t/#u

And, sadly, we lack resources at the moment on our side to follow-up on this :-/

Regards,
Richard Purdie Feb. 4, 2026, 12:34 p.m. UTC | #3
On Wed, 2026-02-04 at 13:31 +0100, Yoann Congal wrote:
> On Wed Feb 4, 2026 at 1:05 PM CET, Paul Barker wrote:
> > On Thu, 2026-01-29 at 08:39 -0800, Sadineni, Harish via
> > lists.openembedded.org wrote:
> > > From: Yoann Congal <yoann.congal@smile.fr>
> > > 
> > > 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)
> > > 
> > > when using ccache, value of "HOSTCC=cache gcc" when this value is passing
> > > to rustc, It is thinking gcc is a input file. when ccache is not used "HOSTCC=gcc" is passed.
> > > 
> > > Disable ccache for kernel build if rust-kernel is enabled to workaround
> > > this.
> > > 
> > > Signed-off-by: El Mehdi YOUNES <elmehdi.younes@smile.fr>
> > > Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> > > Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
> > 
> > This patch is good, but we should try to get the issue resolved upstream
> > if we can so that ccache can be used.
> > 
> > Has this been reported upstream yet? Could you also open a bug in our
> > bugzilla to track this?
> 
> Hello,
> 
> For context, a lengthy discussion happened on this patch here:
> https://lore.kernel.org/openembedded-core/CA+TGqK9Yd2WWKrhMkhofF-8N0cESCSefWD2DXr4sBO9fDQXyrg@mail.gmail.com/t/#u
> 
> And, sadly, we lack resources at the moment on our side to follow-up on this :-/

Putting some links alongside this to more details would probably at
least help a bit, particularly if ccache upstream documents it is
imcompatible with rust...

Cheers,

Richard
Yoann Congal Feb. 4, 2026, 1:07 p.m. UTC | #4
Le mer. 4 févr. 2026 à 13:34, Richard Purdie <
richard.purdie@linuxfoundation.org> a écrit :

> On Wed, 2026-02-04 at 13:31 +0100, Yoann Congal wrote:
> > On Wed Feb 4, 2026 at 1:05 PM CET, Paul Barker wrote:
> > > On Thu, 2026-01-29 at 08:39 -0800, Sadineni, Harish via
> > > lists.openembedded.org wrote:
> > > > From: Yoann Congal <yoann.congal@smile.fr>
> > > >
> > > > 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)
> > > >
> > > > when using ccache, value of "HOSTCC=cache gcc" when this value is
> passing
> > > > to rustc, It is thinking gcc is a input file. when ccache is not
> used "HOSTCC=gcc" is passed.
> > > >
> > > > Disable ccache for kernel build if rust-kernel is enabled to
> workaround
> > > > this.
> > > >
> > > > Signed-off-by: El Mehdi YOUNES <elmehdi.younes@smile.fr>
> > > > Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> > > > Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
> > >
> > > This patch is good, but we should try to get the issue resolved
> upstream
> > > if we can so that ccache can be used.
> > >
> > > Has this been reported upstream yet? Could you also open a bug in our
> > > bugzilla to track this?
> >
> > Hello,
> >
> > For context, a lengthy discussion happened on this patch here:
> >
> https://lore.kernel.org/openembedded-core/CA+TGqK9Yd2WWKrhMkhofF-8N0cESCSefWD2DXr4sBO9fDQXyrg@mail.gmail.com/t/#u
> >
> > And, sadly, we lack resources at the moment on our side to follow-up on
> this :-/
>
> Putting some links alongside this to more details would probably at
> least help a bit, particularly if ccache upstream documents it is
> imcompatible with rust...
>

Ok, I'll send a more documented patch to Harish for him to integrate in his
next iteration.


> Cheers,
>
> Richard
>
>
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
index cd5daaf33b..bfdafbee8c 100644
--- a/meta/classes-recipe/kernel-yocto.bbclass
+++ b/meta/classes-recipe/kernel-yocto.bbclass
@@ -34,6 +34,11 @@  RUST_DEBUG_REMAP = "${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', '--re
 KRUSTFLAGS:append = " ${RUST_DEBUG_REMAP}"
 EXTRA_OEMAKE:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', ' KRUSTFLAGS="${KRUSTFLAGS}"', '',d)}"
 
+# TODO: rust-kernel enabled kernel fails to build with:
+#  | error: multiple input filenames provided (first two filenames are gcc and .../tmp/work-shared/qemux86-64/kernel-source/scripts/generate_rust_target.rs)
+# Disable ccache for kernel build if rust-kernel is enabled to workaround this.
+CCACHE_DISABLE ?= "${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', '1', '0', d)}"
+
 # returns local (absolute) path names for all valid patches in the
 # src_uri
 def find_patches(d,subdir):