Closed TDHolmes closed 3 years ago
The limitations mentioned in #5256 are still in effect. Until GitHub actions provides a runner for your specific platform, we're unable to provide nightly builds for that platform. Please use the rustup component instead.
Note that the rustup component isn't always up-to-date. I'd recommend building from source.
Yeah I've installed from source in the meantime. I would assume GitHub actions will eventually support this, so can we keep this open until that happens?
How hard is it to cross-compile for this target from x86_64 macOS? If it's just one rustup target add
away we can consider it.
Just tried this on my intel Mac and it compiled on nightly with
rustup target add aarch64-apple-darwin
cargo build --target aarch64-apple-darwin
so looks like it is that simple!
rustup v1.23.0 has native suport for aarch64-apple-darwin, and you can add the target as long as you're on beta
or nightly
Rust v1.49.0. It's super easy to cross compile if you're using Big Sur, and if you're using older versions of macOS you just need to have Xcode 12 command line tools and the macOS 11 SDK installed and set some environment variables.
Here are the instructions for cross-compilation from one of the maintainers of Rust, @shepmaster: https://github.com/shepmaster/rust/blob/silicon/silicon/README.md
Here's the tracking issue for Apple Silicon support: https://github.com/rust-lang/rust/issues/73908
Rust for aarch64-apple-darwin is a Tier 2 target and in beta, but it seems to work pretty well. The only reason it's not Tier 1 yet is the lack of availability of CI hardware for running the test suite.
The limitations mentioned in #5256 are still in effect. Until GitHub actions provides a runner for your specific platform, we're unable to provide nightly builds for that platform. Please use the rustup component instead.
@kiljacken What's the update on this, given that GitHub Actions now has macosx11.0
runners, and Rust beta
and nightly
support native cross-compilation for aarch64-apple-darwin
on macOS?
While cross-compilation to ARM macOS is supported by rustc, there is currently no way to run the tests on ARM as Github actions doesn't yet have a runner for this.
I think building binaries but not running tests is a reasonable compromise since most of RA is platform-independent anyway.
I think building binaries but not running tests is a reasonable compromise since most of RA is platform-independent anyway.
You could always mark it as a "Tier 2" platform until you can run tests. Shipping binaries, even ones that might be unstable, is still better than no support at all.
Hi everyone, sorry, it is still not clear for me on how to use rust-analyzer
with aarch64
.
I tried to checked out the project, and run
cargo build --target aarch64-apple-darwin --release
Then I copied ./target/release/rust-analyzer
to my ~/.cargo/bin
but when I launch vs code it still shows me this message
Bootstrap error [Error: Rust Analyzer Language Server is not available. Please, ensure its [proper installation
What else do I need to do to start using this? Thanks in advance, cheers.
Ok after debugging a while looks like we need to change this line https://github.com/rust-analyzer/rust-analyzer/blob/c3d21ea05a1d1e1a88a983773fd821f6f6470264/editors/code/src/main.ts#L291
to something like:
if (process.arch === "x64" || process.arch === "ia32" || process.arch === "arm64") {
Do you want me to make a PR for this?
@phungleson all I did was cargo xtask install
when compiling from my M1 device. No code modification was needed for me.
Thanks @TDHolmes I am running code
in arm mode so it might be the difference?
The difference is that you are using the extension from the vscode marketplace instead of the one that cargo xtask install
would install. The one from the vscode marketplace will try to download the corresponding version from github. The one installed using cargo xtask install
will use the locally built one. There is an extension config to define the path to the rust-analyzer executable.
Ah ok yeah looks like this issue is about building the rust library while my issue is about running the extension for code
, which is also in this repo.
In that case it is still worth putting in the fix for the extension?
I changed my extension locally and it managed to download corresponding version of rust-analyser
and run as usual albeit it is Intel version.
@phungleson to run the native version, you should set rust-analyzer.serverPath
to point to a binary you've compiled and then you can undo that change to the extension.
But maybe we should still apply your change: it's not the best solution (ideally, we'd build and release binaries in CI), but it will make RA work again for users with new Apple devices. Do you want to file that PR?
https://github.com/rust-analyzer/rust-analyzer/pull/6989 is untested, but might be a starting point to providing aarch64-apple-darwin
binaries.
Hey thanks, I made a PR here https://github.com/rust-analyzer/rust-analyzer/pull/6990
I have changed my rust-analyzer.serverPath
but looks like there is some mismatch of my rust-analyzer
, it crashes.
How do I know which version of rust-analyzer
is compatible to my extension?
Which Code version are you using? Maybe try the RA release from last week.
🎉 With #6989 and #7001 merged, Apple Silicon support should be coming in nightly tonight, and in stable ~whenever they decide to do a new release~ next Monday! 🎉
Thanks so much for your time and effort @lnicola!
There is a new release every monday.
This seems to be working for me now! Should this be closed? Thanks for enabling this so quickly
Yes! Thanks for testing.
They should also ship this for alpine :/
We already do. https://github.com/rust-lang/rust-analyzer/releases/tag/2023-06-05 there is rust-analyzer-alpine-x64.vsix
and rust-analyzer-x86_64-unknown-linux-musl.gz
.
We already do. https://github.com/rust-lang/rust-analyzer/releases/tag/2023-06-05 there is
rust-analyzer-alpine-x64.vsix
andrust-analyzer-x86_64-unknown-linux-musl.gz
.
thats x86.
You mean shipping binaries for aarch64 alpine? Didn't connect the dots. My bad. Opening a new issue would be helpful I think.
You mean shipping binaries for aarch64 alpine? Didn't connect the dots. My bad. Opening a new issue would be helpful I think.
I did, sorry for my rudeness. https://github.com/rust-lang/rust-analyzer/issues/15004
I tried setting up my new Mac with rust-analyzer and got an error that binaries aren't shipped for this architecture. Makes sense as it's so new, but getting support for this would be great.