Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Benhur Tessele <benhur.tessele@est.tech>
To: openembedded-core@lists.openembedded.org
Cc: Randy MacLeod <Randy.MacLeod@windriver.com>,
	Benhur Tessele <benhur.tessele@est.tech>
Subject: [PATCH 1/2] rust: package rust-analyzer as rust-tools-analyzer
Date: Thu,  1 Oct 2026 14:56:29 +0200	[thread overview]
Message-ID: <20261001125630.760962-2-benhur.tessele@est.tech> (raw)
In-Reply-To: <20261001125630.760962-1-benhur.tessele@est.tech>

rust-analyzer is built alongside the other Rust tools (clippy, rustfmt)
but was not installed or packaged. Add a rust-tools-analyzer package and
install it for both the target and nativesdk variants.

Two additional pieces are required for rust-analyzer to be usable:

 - The proc-macro server, rust-analyzer-proc-macro-srv, which
   rust-analyzer looks up under <sysroot>/libexec. Install it into
   ${libexecdir}; without it, analysis of any crate using a derive or
   attribute macro fails with "cannot find proc-macro server in sysroot".

 - The standard library sources, which rust-analyzer analyses from source
   rather than from the compiled rlibs. Add an RDEPENDS on ${PN}-src-lib
   so that core/std items such as println! and derive resolve instead of
   being reported as unresolved macros.

Both binaries link against librustc_driver from the main package, so the
package also RDEPENDS on ${PN}.

Signed-off-by: Benhur Tessele <benhur.tessele@est.tech>
---
 meta/recipes-devtools/rust/rust_1.98.1.bb | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-devtools/rust/rust_1.98.1.bb b/meta/recipes-devtools/rust/rust_1.98.1.bb
index 1f4ce5ebdb..d446c60651 100644
--- a/meta/recipes-devtools/rust/rust_1.98.1.bb
+++ b/meta/recipes-devtools/rust/rust_1.98.1.bb
@@ -261,18 +261,21 @@ do_test_compile () {
 
 ALLOW_EMPTY:${PN} = "1"
 
-PACKAGES =+ "${PN}-rustdoc ${PN}-tools-clippy ${PN}-tools-rustfmt ${PN}-src-lib"
+PACKAGES =+ "${PN}-rustdoc ${PN}-tools-clippy ${PN}-tools-rustfmt ${PN}-tools-analyzer ${PN}-src-lib"
 FILES:${PN}-rustdoc = "${bindir}/rustdoc"
 FILES:${PN}-tools-clippy = "${bindir}/cargo-clippy ${bindir}/clippy-driver"
 FILES:${PN}-tools-rustfmt = "${bindir}/rustfmt"
+FILES:${PN}-tools-analyzer = "${bindir}/rust-analyzer ${libexecdir}/rust-analyzer-proc-macro-srv"
 FILES:${PN}-src-lib = "${libdir}/rustlib/src/rust"
 
 RDEPENDS:${PN}-rustdoc = "${PN}"
 RDEPENDS:${PN}-tools-clippy = "${PN}"
 RDEPENDS:${PN}-tools-rustfmt = "${PN}"
+RDEPENDS:${PN}-tools-analyzer = "${PN} ${PN}-src-lib"
 
 SUMMARY:${PN}-tools-clippy = "A collection of lints to catch common mistakes and improve your Rust code"
 SUMMARY:${PN}-tools-rustfmt = "A tool for formatting Rust code according to style guidelines"
+SUMMARY:${PN}-tools-analyzer = "A language server providing IDE features for Rust"
 
 do_install () {
     rust_do_install
@@ -294,14 +297,19 @@ rust_do_install:class-nativesdk() {
     rust_runx install
     rust_runx install clippy
     rust_runx install rustfmt
+    rust_runx install rust-analyzer
     unset PSEUDO_UNLOAD
 
     install -d ${D}${bindir}
-    for i in cargo-clippy clippy-driver rustfmt; do
+    for i in cargo-clippy clippy-driver rustfmt rust-analyzer; do
         cp rust-build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir}
         patchelf --set-rpath "\$ORIGIN/../lib" ${D}${bindir}/$i
     done
 
+    install -d ${D}${libexecdir}
+    cp rust-build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/rust-analyzer-proc-macro-srv ${D}${libexecdir}
+    patchelf --set-rpath "\$ORIGIN/../lib" ${D}${libexecdir}/rust-analyzer-proc-macro-srv
+
     chown root:root ${D}/ -R
     rm ${D}${libdir}/rustlib/uninstall.sh
     rm ${D}${libdir}/rustlib/install.log
@@ -329,12 +337,13 @@ rust_do_install:class-nativesdk() {
 
 FILES:${PN} += "${base_prefix}/environment-setup.d"
 
-EXTRA_TOOLS ?= "cargo-clippy clippy-driver rustfmt"
+EXTRA_TOOLS ?= "cargo-clippy clippy-driver rustfmt rust-analyzer"
 rust_do_install:class-target() {
     export PSEUDO_UNLOAD=1
     rust_runx install
     rust_runx install clippy
     rust_runx install rustfmt
+    rust_runx install rust-analyzer
     unset PSEUDO_UNLOAD
 
     install -d ${D}${bindir}
@@ -343,6 +352,10 @@ rust_do_install:class-target() {
         patchelf --set-rpath "\$ORIGIN/../lib" ${D}${bindir}/$i
     done
 
+    install -d ${D}${libexecdir}
+    cp rust-build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/rust-analyzer-proc-macro-srv ${D}${libexecdir}
+    patchelf --set-rpath "\$ORIGIN/../lib" ${D}${libexecdir}/rust-analyzer-proc-macro-srv
+
     install -d ${D}${libdir}/rustlib/${RUST_HOST_SYS}
     install -m 0644 ${WORKDIR}/rust-targets/${RUST_HOST_SYS}.json ${D}${libdir}/rustlib/${RUST_HOST_SYS}/target.json
     install -d ${D}${libdir}/rustlib/src/rust
-- 
2.43.0



  reply	other threads:[~2026-10-01 12:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 12:56 [PATCH 0/2] rust: add rust-analyzer support Benhur Tessele
2026-10-01 12:56 ` Benhur Tessele [this message]
2026-10-01 12:56 ` [PATCH 2/2] packagegroup-rust-cross-canadian: add rust-analyzer to the SDK Benhur Tessele
2026-10-01 14:08 ` [OE-core] [PATCH 0/2] rust: add rust-analyzer support Mathieu Dubois-Briand
2026-10-02  9:05   ` Paul Barker
2026-10-02 14:54     ` Benhur T
2026-10-01 14:13 ` Paul Barker
2026-10-01 15:47   ` Benhur T
2026-10-02  9:00     ` Paul Barker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261001125630.760962-2-benhur.tessele@est.tech \
    --to=benhur.tessele@est.tech \
    --cc=Randy.MacLeod@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox