rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Ship binaries for 32-bit ARM architecture

Open Jonahss opened this issue 4 years ago • 17 comments
trafficstars

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.

Jonahss avatar Jul 22 '21 04:07 Jonahss

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.

lnicola avatar Jul 22 '21 04:07 lnicola

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.

jonas-schievink avatar Jul 22 '21 12:07 jonas-schievink

I think Raspbian is still 32-bit: https://www.raspberrypi.org/software/operating-systems/

lnicola avatar Jul 22 '21 12:07 lnicola

Oh

jonas-schievink avatar Jul 22 '21 12:07 jonas-schievink

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.

Jonahss avatar Jul 25 '21 16:07 Jonahss

Is there any reason why you couldn't use the version in rustup?

lnicola avatar Jul 25 '21 16:07 lnicola

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.

Jonahss avatar Jul 25 '21 16:07 Jonahss

Oh, okay.

an hour

Ugh.

lnicola avatar Jul 25 '21 16:07 lnicola

I thought that was pretty good for the Raspberry Pi!

Jonahss avatar Jul 25 '21 17:07 Jonahss

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.

cr1901 avatar Jul 27 '22 23:07 cr1901

There is an open rustup PR to add a rustup wrapper for rust-analyzer.

bjorn3 avatar Jul 28 '22 07:07 bjorn3

(https://github.com/rust-lang/rustup/pull/3022 adds the wrapper)

jonas-schievink avatar Jul 28 '22 19:07 jonas-schievink

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.

jonas-schievink avatar Jul 28 '22 19:07 jonas-schievink

Yeah. Windows 32-bit has also been requested quite often.

lnicola avatar Jul 28 '22 19:07 lnicola

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 avatar Aug 01 '22 15:08 jonas-schievink

@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

cr1901 avatar Aug 02 '22 01:08 cr1901

Great to hear! It would be good if someone could test on a Raspberry Pi too, since those are used quite often.

jonas-schievink avatar Aug 02 '22 16:08 jonas-schievink

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 :).

cr1901 avatar Aug 23 '22 15:08 cr1901

If your plugin downloads anything, that's probably https://github.com/rust-lang/rust-analyzer/issues/11080.

lnicola avatar Aug 23 '22 15:08 lnicola

arm-unknown-linux-gnueabihf was added in #12920. I don't know if we want to build for other ARM variants. Maybe newer ones?

lnicola avatar Feb 11 '23 16:02 lnicola