mbox series

[0/2] rust: add rust-analyzer support

Message ID 20261001125630.760962-1-benhur.tessele@est.tech
Headers show
Series rust: add rust-analyzer support | expand

Message

Benhur T Oct. 1, 2026, 12:56 p.m. UTC
rust-analyzer is built as part of the Rust tools but was neither
installed nor packaged. This series packages it and wires it into the
Rust SDK next to clippy and rustfmt.

Patch 1 adds a rust-tools-analyzer package for the target and nativesdk
variants. Beyond the frontend binary it also ships the proc-macro server
and depends on the standard library sources, both of which are required
for rust-analyzer to actually function.

Patch 2 adds it to the cross-canadian toolchain so that an SDK built with
SDK_FEATURES = "rust" provides rust-analyzer out of the box.

Testing:
 - Patches validated with patchset.
 - Built an SDK with SDK_FEATURES = "rust", installed it in a container,
   and confirmed rust-analyzer resolves the standard library and expands
   proc-macros end to end: diagnostics/analysis-stats on a crate using a
   derive macro succeed, with the proc-macro server started from
   <sysroot>/libexec.
 - Built core-image-minimal with rust-tools-analyzer installed, booted it
   under qemu, and confirmed the rust-analyzer frontend and the
   rust-analyzer-proc-macro-srv binary are present with their libraries
   resolving.

Benhur Tessele (2):
  rust: package rust-analyzer as rust-tools-analyzer
  packagegroup-rust-cross-canadian: add rust-analyzer to the SDK

 .../packagegroup-rust-cross-canadian.bb       |  1 +
 meta/recipes-devtools/rust/rust_1.98.1.bb     | 19 ++++++++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

Comments

Mathieu Dubois-Briand Oct. 1, 2026, 2:08 p.m. UTC | #1
On Thu Oct 1, 2026 at 2:56 PM CEST, Benhur T wrote:
> rust-analyzer is built as part of the Rust tools but was neither
> installed nor packaged. This series packages it and wires it into the
> Rust SDK next to clippy and rustfmt.
>
> Patch 1 adds a rust-tools-analyzer package for the target and nativesdk
> variants. Beyond the frontend binary it also ships the proc-macro server
> and depends on the standard library sources, both of which are required
> for rust-analyzer to actually function.
>
> Patch 2 adds it to the cross-canadian toolchain so that an SDK built with
> SDK_FEATURES = "rust" provides rust-analyzer out of the box.
>
> Testing:
>  - Patches validated with patchset.
>  - Built an SDK with SDK_FEATURES = "rust", installed it in a container,
>    and confirmed rust-analyzer resolves the standard library and expands
>    proc-macros end to end: diagnostics/analysis-stats on a crate using a
>    derive macro succeed, with the proc-macro server started from
>    <sysroot>/libexec.
>  - Built core-image-minimal with rust-tools-analyzer installed, booted it
>    under qemu, and confirmed the rust-analyzer frontend and the
>    rust-analyzer-proc-macro-srv binary are present with their libraries
>    resolving.
>
> Benhur Tessele (2):
>   rust: package rust-analyzer as rust-tools-analyzer
>   packagegroup-rust-cross-canadian: add rust-analyzer to the SDK
>
>  .../packagegroup-rust-cross-canadian.bb       |  1 +
>  meta/recipes-devtools/rust/rust_1.98.1.bb     | 19 ++++++++++++++++---
>  2 files changed, 17 insertions(+), 3 deletions(-)

Hi Benhur,

Thanks for your patch.

I believe this is breaking build on some platforms. Maybe all ARM 32
bits?

ERROR: rust-1.98.1-r0 do_install: Execution of '/srv/pokybuild/yocto-worker/beaglebone-alt/build/build/tmp/work/cortexa8t2hf-neon-poky-linux-gnueabi/rust/1.98.1/temp/run.do_install.3194208' failed with exit code 1
...
| error[E0658]: use of unstable library feature `stdarch_arm_neon_intrinsics`
|   --> /rust/deps/simd-adler32-0.3.9/src/imp/neon.rs:23:7
|    |
| 23 |   use core::arch::arm::*;
|    |       ^^^^^^^^^^^^^^^
|    |
|    = note: see issue #111800 <https://github.com/rust-lang/rust/issues/111800> for more information
|    = help: add `#![feature(stdarch_arm_neon_intrinsics)]` to the crate attributes to enable
|    = note: this compiler was built on 2026-09-01; consider upgrading it if it is out of date
...
| -------------
| error: could not compile `simd-adler32` (lib) due to 67 previous errors
| warning: build failed, waiting for other jobs to finish...
...

https://autobuilder.yoctoproject.org/valkyrie/#/builders/10/builds/4734
https://autobuilder.yoctoproject.org/valkyrie/#/builders/74/builds/4706

Can you have a look at the issue?

Thanks,
Mathieu
Paul Barker Oct. 1, 2026, 2:13 p.m. UTC | #2
On Thu, 2026-10-01 at 14:56 +0200, Benhur Tessele wrote:
> rust-analyzer is built as part of the Rust tools but was neither
> installed nor packaged. This series packages it and wires it into the
> Rust SDK next to clippy and rustfmt.
> 
> Patch 1 adds a rust-tools-analyzer package for the target and nativesdk
> variants. Beyond the frontend binary it also ships the proc-macro server
> and depends on the standard library sources, both of which are required
> for rust-analyzer to actually function.
> 
> Patch 2 adds it to the cross-canadian toolchain so that an SDK built with
> SDK_FEATURES = "rust" provides rust-analyzer out of the box.
> 
> Testing:
>  - Patches validated with patchset.
>  - Built an SDK with SDK_FEATURES = "rust", installed it in a container,
>    and confirmed rust-analyzer resolves the standard library and expands
>    proc-macros end to end: diagnostics/analysis-stats on a crate using a
>    derive macro succeed, with the proc-macro server started from
>    <sysroot>/libexec.
>  - Built core-image-minimal with rust-tools-analyzer installed, booted it
>    under qemu, and confirmed the rust-analyzer frontend and the
>    rust-analyzer-proc-macro-srv binary are present with their libraries
>    resolving.
> 
> Benhur Tessele (2):
>   rust: package rust-analyzer as rust-tools-analyzer
>   packagegroup-rust-cross-canadian: add rust-analyzer to the SDK

Hi,

Two quick questions here:

1) What's the intended use case for rust-analyzer, particularly on the
   target? I think we need at least a brief reason why it's worth
   enabling this.

2) What impact does this have on the build and package creation time for
   rust?

Best regards,
Benhur T Oct. 1, 2026, 3:47 p.m. UTC | #3
> 1) What's the intended use case for rust-analyzer, particularly on the
>     target? I think we need at least a brief reason why it's worth
>     enabling this.
> 
> 2) What impact does this have on the build and package creation time for
>     rust?
Hi Paul, thanks for the relevant comments.

1) Short answer: I don't know. I agree with you seems odd, but I just 
followed what's already done for the other tools (clippy, rustfmt). I'm 
more than happy to remove it from target is that's the right approach.

2) On my build environment (poky/qemux86-64) there's a build time increase.

master
|- do_install: Elapsed time: 524.36 seconds
`- do_package: Elapsed time: 16.49 seconds

with my patches
|- do_install: Elapsed time: 619.82 seconds
`- do_package: Elapsed time: 17.16 seconds

Best regards,
Ben
Paul Barker Oct. 2, 2026, 9 a.m. UTC | #4
On Thu, 2026-10-01 at 17:47 +0200, Benhur T wrote:
> > 1) What's the intended use case for rust-analyzer, particularly on the
> >     target? I think we need at least a brief reason why it's worth
> >     enabling this.
> > 
> > 2) What impact does this have on the build and package creation time for
> >     rust?
> Hi Paul, thanks for the relevant comments.
> 
> 1) Short answer: I don't know. I agree with you seems odd, but I just 
> followed what's already done for the other tools (clippy, rustfmt). I'm 
> more than happy to remove it from target is that's the right approach.

I think we need to be careful here. Adding more features is great, but
they often also add complexity and maintenance burden. Even simple
addition of a new component within an existing recipe is one more thing
that can fail, as seen in Mathieu's reply [1].

[1]: https://lore.kernel.org/all/DLTK70W1LZPD.1WPEJTEXRP8Q1@bootlin.com/

We definitely want to take new features that people will use, but we
should avoid enabling things just for the sake of it if there is no
clear use case.

Are you using rust-analyzer from the SDK?

> 
> 2) On my build environment (poky/qemux86-64) there's a build time increase.
> 
> master
> > - do_install: Elapsed time: 524.36 seconds
> `- do_package: Elapsed time: 16.49 seconds
> 
> with my patches
> > - do_install: Elapsed time: 619.82 seconds
> `- do_package: Elapsed time: 17.16 seconds

This is a noticeable jump. We should put this behind a PACKAGECONFIG
option which is disabled by default.

Best regards,
Paul Barker Oct. 2, 2026, 9:05 a.m. UTC | #5
On Thu, 2026-10-01 at 16:08 +0200, Mathieu Dubois-Briand wrote:
> On Thu Oct 1, 2026 at 2:56 PM CEST, Benhur T wrote:
> > rust-analyzer is built as part of the Rust tools but was neither
> > installed nor packaged. This series packages it and wires it into the
> > Rust SDK next to clippy and rustfmt.
> > 
> > Patch 1 adds a rust-tools-analyzer package for the target and nativesdk
> > variants. Beyond the frontend binary it also ships the proc-macro server
> > and depends on the standard library sources, both of which are required
> > for rust-analyzer to actually function.
> > 
> > Patch 2 adds it to the cross-canadian toolchain so that an SDK built with
> > SDK_FEATURES = "rust" provides rust-analyzer out of the box.
> > 
> > Testing:
> >  - Patches validated with patchset.
> >  - Built an SDK with SDK_FEATURES = "rust", installed it in a container,
> >    and confirmed rust-analyzer resolves the standard library and expands
> >    proc-macros end to end: diagnostics/analysis-stats on a crate using a
> >    derive macro succeed, with the proc-macro server started from
> >    <sysroot>/libexec.
> >  - Built core-image-minimal with rust-tools-analyzer installed, booted it
> >    under qemu, and confirmed the rust-analyzer frontend and the
> >    rust-analyzer-proc-macro-srv binary are present with their libraries
> >    resolving.
> > 
> > Benhur Tessele (2):
> >   rust: package rust-analyzer as rust-tools-analyzer
> >   packagegroup-rust-cross-canadian: add rust-analyzer to the SDK
> > 
> >  .../packagegroup-rust-cross-canadian.bb       |  1 +
> >  meta/recipes-devtools/rust/rust_1.98.1.bb     | 19 ++++++++++++++++---
> >  2 files changed, 17 insertions(+), 3 deletions(-)
> 
> Hi Benhur,
> 
> Thanks for your patch.
> 
> I believe this is breaking build on some platforms. Maybe all ARM 32
> bits?
> 
> ERROR: rust-1.98.1-r0 do_install: Execution of '/srv/pokybuild/yocto-worker/beaglebone-alt/build/build/tmp/work/cortexa8t2hf-neon-poky-linux-gnueabi/rust/1.98.1/temp/run.do_install.3194208' failed with exit code 1
> ...
> > error[E0658]: use of unstable library feature `stdarch_arm_neon_intrinsics`
> >   --> /rust/deps/simd-adler32-0.3.9/src/imp/neon.rs:23:7
> >    |
> > 23 |   use core::arch::arm::*;
> >    |       ^^^^^^^^^^^^^^^
> >    |
> >    = note: see issue #111800 <https://github.com/rust-lang/rust/issues/111800> for more information
> >    = help: add `#![feature(stdarch_arm_neon_intrinsics)]` to the crate attributes to enable
> >    = note: this compiler was built on 2026-09-01; consider upgrading it if it is out of date
> ...
> > -------------
> > error: could not compile `simd-adler32` (lib) due to 67 previous errors
> > warning: build failed, waiting for other jobs to finish...
> ...
> 
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/10/builds/4734
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/74/builds/4706
> 
> Can you have a look at the issue?

One thing that's concerning here: We're seeing a compiler error message
during do_install. That suggests we're missing a build step in
do_compile, as things should already be built by the time we get to
do_install.

That may be a pre-existing issue for the rust recipe, if it is then we
should make sure there is a bug filed for it.

Best regards,