rust-analyzer
rust-analyzer copied to clipboard
Ship binaries for 32-bit ARM architecture
I installed rust-analyzer for VSCode and an error message popped up:
Unfortunately we don't ship binaries for your platform yet.
You need to manually clone rust-analyzer repository and run
`cargo xtask install --server` to build the language server from sources.
If you feel that your platform should be supported,
please create an issue about that here and we will consider it.
I'm working on an embedded Rust project on my Raspberry Pi. I'm using VSCode's "remote ssh" mode, where the code lives on the Raspberry Pi but I'm developing remotely from my Macbook.
I'll try building from source, but adding the issue here because the helpful error message suggested it.
We have AArch64 (64-bit ARM) binaries, but not 32-bit ones. Our memory usage tends to get a bit high, and the 3GB available on 32-bit might sometimes be tight, depending on how much code you have.
But you don't need to compile it, you can get a it from rustup. It's available in the nightly toolchain as rust-analyzer-preview, and you can set the path to it in the Code config.
That doesn't mean you can use nightly for your project, you can keep on using stable as the default toolchain.
Most Raspberry Pis are AArch64, maybe you've installed a 32-bit OS by accident? What does uname -a print?
Using rust-analyzer should work on a Raspberry Pi 4, but you'll probably want the version with 8 GB of RAM.
I think Raspbian is still 32-bit: https://www.raspberrypi.org/software/operating-systems/
Oh
Well, I got it working after building from source. For now, my project is very tiny, so the memory usage is not a problem. It looks like there might be an official 64bit release of Raspberry Pi OS in August.
Is there any reason why you couldn't use the version in rustup?
Is there any reason why you couldn't use the version in
rustup?
I didn't try. I had already started compiling by the time I posted the original issue. It took about an hour on my Raspbery Pi 4. If I had to do it again, I'd try rustup.
Oh, okay.
an hour
Ugh.
I thought that was pretty good for the Raspberry Pi!
I would personally still be interested in 32-bit ARM binaries, if only to avoid any extra manual work of having to install binaries and have new versions of the VSCode plugin just "do the right thing". In the interim, down to 36 minutes on a 4-core SBC w/ 2GB RAM:
Finished release [optimized] target(s) in 36m 39s
Replacing /home/wjones/.cargo/bin/rust-analyzer
Replaced package `rust-analyzer v0.0.0 (/home/wjones/src/rust/rust-analyzer/crates/rust-analyzer)` with `rust-analyzer v0.0.0 (/home/wjones/src/rust/rust-analyzer/crates/rust-analyzer)` (executable `rust-analyzer`)
wjones@DietPi:~/src/rust/rust-analyzer$ uname -a
Linux DietPi 4.19.69-rockchip #5.95 SMP PREEMPT Mon Sep 2 07:34:36 CEST 2019 armv7l GNU/Linux
Is there any reason why you couldn't use the version in rustup?
Although I guess this should be obvious in retrospect, the docs didn't make it clear that a rust-analyzer installed from rustup works regardless of the toolchain you're using and there's no e.g. toolchain overrides needed to invoke the analyzer.
If rust-analyzer uses the default install path, using rustup from now on is fine w/ me.
There is an open rustup PR to add a rustup wrapper for rust-analyzer.
(https://github.com/rust-lang/rustup/pull/3022 adds the wrapper)
VS Code does seem to support 32-bit ARM, and according to https://code.visualstudio.com/api/working-with-extensions/publishing-extension#platformspecific-extensions it has a linux-armhf target. We could try to publish an extension bundle for that.
Yeah. Windows 32-bit has also been requested quite often.
With https://github.com/rust-lang/rust-analyzer/pull/12920, the prerelease version 0.4.1154 now provides a 32-bit ARM Linux release. Please try it out to see if it works.
@jonas-schievink The pre-release appears to be working correctly on my SBC, thanks for adding it!
INFO [8/1/2022, 8:58:14 PM]: Using server binary at /home/wjones/.vscode-server/extensions/rust-lang.rust-analyzer-0.4.1154-linux-armhf/server/rust-analyzer
wjones@DietPi:~/src/rust/pi-ctl$ uname -a
Linux DietPi 4.19.69-rockchip #5.95 SMP PREEMPT Mon Sep 2 07:34:36 CEST 2019 armv7l GNU/Linux
Great to hear! It would be good if someone could test on a Raspberry Pi too, since those are used quite often.
https://github.com/rust-lang/rust-analyzer/issues/13081 may apply to this issue as well- it does on my SBC running Buster. I'll upgrade to Bullseye soon.
However, the plugin itself downloads the binary just fine (which then results in the GLIBC 2.29 error), so workaround until I upgrade is this comment. Also, make sure to replace nightly-x86_64-unknown-linux-gnu with nightly-armv7-unknown-linux-gnueabihf or equivalent, like I managed to forget :).
If your plugin downloads anything, that's probably https://github.com/rust-lang/rust-analyzer/issues/11080.
arm-unknown-linux-gnueabihf was added in #12920. I don't know if we want to build for other ARM variants. Maybe newer ones?