Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] packages/linux-tools: perf: explicitily disable rust if not selected
@ 2026-07-27 13:03 Bastien Curutchet via buildroot
  2026-10-07 11:07 ` Charlie Jenkins
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien Curutchet via buildroot @ 2026-07-27 13:03 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Petazzoni, Bastien Curutchet

Since kernel v7.0, perf uses `rustc --version` to know whether or not
rust is available. If rust is installed on the host, this `rustc
--version` works fine but then the perf build fails with following error
(on aarch64) if the host-rust isn't selected:

rustc  /home/bastien/embedded-linux-imx93-frdm-labs/integration/buildroot/output/build/linux-7.1.3/tools/perf/tests/workloads/code_with_type.a
error[E0463]: can't find crate for `std`
  |
  = note: the `aarch64-unknown-linux-gnu` target may not be installed
  = help: consider downloading the target with `rustup target add aarch64-unknown-linux-gnu`

error: aborting due to 1 previous error

Add a dependency to host-rustc if already enabled, explicitily disable
perf's rust part otherwise

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
---
 package/linux-tools/linux-tool-perf.mk.in | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/package/linux-tools/linux-tool-perf.mk.in b/package/linux-tools/linux-tool-perf.mk.in
index 3238948d76..9718d83121 100644
--- a/package/linux-tools/linux-tool-perf.mk.in
+++ b/package/linux-tools/linux-tool-perf.mk.in
@@ -134,6 +134,12 @@ else
 PERF_MAKE_FLAGS += NO_LIBTRACEEVENT=1
 endif
 
+ifeq ($(BR2_PACKAGE_HOST_RUSTC),y)
+PERF_DEPENDENCIES += host-rustc
+else
+PERF_MAKE_FLAGS += NO_RUST=1
+endif
+
 # We really do not want to build the perf documentation, because it
 # has stringent requirement on the documentation generation tools,
 # like xmlto and asciidoc), which may be lagging behind on some

---
base-commit: cdeeb9b9c688b5bcdcc80bf89f2c046b0bd55bb8
change-id: 20260724-perf-fix-f14d1c7fb681

Best regards,
-- 
Bastien Curutchet <bastien.curutchet@bootlin.com>

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] packages/linux-tools: perf: explicitily disable rust if not selected
  2026-07-27 13:03 [Buildroot] [PATCH] packages/linux-tools: perf: explicitily disable rust if not selected Bastien Curutchet via buildroot
@ 2026-10-07 11:07 ` Charlie Jenkins
  2026-10-07 13:36   ` Bastien Curutchet via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Charlie Jenkins @ 2026-10-07 11:07 UTC (permalink / raw)
  To: Bastien Curutchet; +Cc: buildroot, Thomas Petazzoni

On Mon, Jul 27, 2026 at 03:03:46PM +0200, Bastien Curutchet via buildroot wrote:
> Since kernel v7.0, perf uses `rustc --version` to know whether or not
> rust is available. If rust is installed on the host, this `rustc
> --version` works fine but then the perf build fails with following error
> (on aarch64) if the host-rust isn't selected:
> 
> rustc  /home/bastien/embedded-linux-imx93-frdm-labs/integration/buildroot/output/build/linux-7.1.3/tools/perf/tests/workloads/code_with_type.a
> error[E0463]: can't find crate for `std`
>   |
>   = note: the `aarch64-unknown-linux-gnu` target may not be installed
>   = help: consider downloading the target with `rustup target add aarch64-unknown-linux-gnu`
> 
> error: aborting due to 1 previous error
> 
> Add a dependency to host-rustc if already enabled, explicitily disable
> perf's rust part otherwise
> 
> Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
> ---
>  package/linux-tools/linux-tool-perf.mk.in | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/package/linux-tools/linux-tool-perf.mk.in b/package/linux-tools/linux-tool-perf.mk.in
> index 3238948d76..9718d83121 100644
> --- a/package/linux-tools/linux-tool-perf.mk.in
> +++ b/package/linux-tools/linux-tool-perf.mk.in
> @@ -134,6 +134,12 @@ else
>  PERF_MAKE_FLAGS += NO_LIBTRACEEVENT=1
>  endif
>  
> +ifeq ($(BR2_PACKAGE_HOST_RUSTC),y)
> +PERF_DEPENDENCIES += host-rustc

Even with this dependency I am still getting the std error. I am
building for riscv64. Does this resolve for you?

There is the Kconfig BR2_PACKAGE_LINUX_TOOLS_PERF_NEEDS_HOST_PYTHON3,
maybe instead of depending on RUSTC when enabled should this introduce
an option similar to the python option?

Rust is also only being used by a linux perf test case so it's not
really even needed for regular perf usage.

- Charlie

> +else
> +PERF_MAKE_FLAGS += NO_RUST=1
> +endif
> +
>  # We really do not want to build the perf documentation, because it
>  # has stringent requirement on the documentation generation tools,
>  # like xmlto and asciidoc), which may be lagging behind on some
> 
> ---
> base-commit: cdeeb9b9c688b5bcdcc80bf89f2c046b0bd55bb8
> change-id: 20260724-perf-fix-f14d1c7fb681
> 
> Best regards,
> -- 
> Bastien Curutchet <bastien.curutchet@bootlin.com>
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] packages/linux-tools: perf: explicitily disable rust if not selected
  2026-10-07 11:07 ` Charlie Jenkins
@ 2026-10-07 13:36   ` Bastien Curutchet via buildroot
  2026-10-08  6:22     ` Fengwei Tan
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien Curutchet via buildroot @ 2026-10-07 13:36 UTC (permalink / raw)
  To: Charlie Jenkins; +Cc: buildroot, Thomas Petazzoni

Hi Charlie,

On 10/7/26 1:07 PM, Charlie Jenkins wrote:
> On Mon, Jul 27, 2026 at 03:03:46PM +0200, Bastien Curutchet via buildroot wrote:
>> Since kernel v7.0, perf uses `rustc --version` to know whether or not
>> rust is available. If rust is installed on the host, this `rustc
>> --version` works fine but then the perf build fails with following error
>> (on aarch64) if the host-rust isn't selected:
>>
>> rustc  /home/bastien/embedded-linux-imx93-frdm-labs/integration/buildroot/output/build/linux-7.1.3/tools/perf/tests/workloads/code_with_type.a
>> error[E0463]: can't find crate for `std`
>>    |
>>    = note: the `aarch64-unknown-linux-gnu` target may not be installed
>>    = help: consider downloading the target with `rustup target add aarch64-unknown-linux-gnu`
>>
>> error: aborting due to 1 previous error
>>
>> Add a dependency to host-rustc if already enabled, explicitily disable
>> perf's rust part otherwise
>>
>> Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
>> ---
>>   package/linux-tools/linux-tool-perf.mk.in | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/package/linux-tools/linux-tool-perf.mk.in b/package/linux-tools/linux-tool-perf.mk.in
>> index 3238948d76..9718d83121 100644
>> --- a/package/linux-tools/linux-tool-perf.mk.in
>> +++ b/package/linux-tools/linux-tool-perf.mk.in
>> @@ -134,6 +134,12 @@ else
>>   PERF_MAKE_FLAGS += NO_LIBTRACEEVENT=1
>>   endif
>>   
>> +ifeq ($(BR2_PACKAGE_HOST_RUSTC),y)
>> +PERF_DEPENDENCIES += host-rustc
> 
> Even with this dependency I am still getting the std error. I am
> building for riscv64. Does this resolve for you?
> 

Yes it did solve my issue (on arm-64).

> There is the Kconfig BR2_PACKAGE_LINUX_TOOLS_PERF_NEEDS_HOST_PYTHON3,
> maybe instead of depending on RUSTC when enabled should this introduce
> an option similar to the python option?
>

It doesn't seem needed to me. If host-rustc has already been selected by 
another package then having the dependency enabled should be enough.

> Rust is also only being used by a linux perf test case so it's not
> really even needed for regular perf usage.
>

I hadn't looked at how perf use rust. Maybe we can always call NO_RUST=1 
then.

Regards,
Bastien
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] packages/linux-tools: perf: explicitily disable rust if not selected
  2026-10-07 13:36   ` Bastien Curutchet via buildroot
@ 2026-10-08  6:22     ` Fengwei Tan
  0 siblings, 0 replies; 4+ messages in thread
From: Fengwei Tan @ 2026-10-08  6:22 UTC (permalink / raw)
  To: Bastien Curutchet, Charlie Jenkins; +Cc: buildroot, Thomas Petazzoni

Hi all,

在 2026/10/7 21:36, Bastien Curutchet via buildroot 写道:
>>> diff --git a/package/linux-tools/linux-tool-perf.mk.in b/package/linux-tools/linux-tool-perf.mk.in
>>> index 3238948d76..9718d83121 100644
>>> --- a/package/linux-tools/linux-tool-perf.mk.in
>>> +++ b/package/linux-tools/linux-tool-perf.mk.in
>>> @@ -134,6 +134,12 @@ else
>>>   PERF_MAKE_FLAGS += NO_LIBTRACEEVENT=1
>>>   endif
>>>   +ifeq ($(BR2_PACKAGE_HOST_RUSTC),y)
>>> +PERF_DEPENDENCIES += host-rustc
>>
>> Even with this dependency I am still getting the std error. I am
>> building for riscv64. Does this resolve for you?
>>
> 
> Yes it did solve my issue (on arm-64).

I reproduced the same error when building for riscv64 with this config:
https://gist.github.com/tfx2001/6902e8450ee93a9fb2df97375cab318f

The root cause is that host-rustc will only install target rust-std
library when BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS is y, which
depends on BR2_RISCV_ISA_RVC:
https://gitlab.com/buildroot.org/buildroot/-/blob/b6525e9cf89394d45e1c74085d0d1d039bd890d0/package/rustc/Config.in.host#L57

Therefore, simply checking BR2_PACKAGE_HOST_RUSTC is not enough. If we
want to keep rust part enabled when available, we should also check
BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS and set NO_RUST=1 otherwise.

> 
>> There is the Kconfig BR2_PACKAGE_LINUX_TOOLS_PERF_NEEDS_HOST_PYTHON3,
>> maybe instead of depending on RUSTC when enabled should this introduce
>> an option similar to the python option?
>>
> 
> It doesn't seem needed to me. If host-rustc has already been selected by another package then having the dependency enabled should be enough.
> 
>> Rust is also only being used by a linux perf test case so it's not
>> really even needed for regular perf usage.
>>
> 
> I hadn't looked at how perf use rust. Maybe we can always call NO_RUST=1 then.

Alternatively, since rust is only used for a perf test workload here:
https://github.com/torvalds/linux/blob/v7.2/tools/perf/tests/workloads/code_with_type.rs

Always setting NO_RUST=1 would also avoid this issue.

Best regards,
Fengwei Tan
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2026-10-08  6:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-27 13:03 [Buildroot] [PATCH] packages/linux-tools: perf: explicitily disable rust if not selected Bastien Curutchet via buildroot
2026-10-07 11:07 ` Charlie Jenkins
2026-10-07 13:36   ` Bastien Curutchet via buildroot
2026-10-08  6:22     ` Fengwei Tan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox