Rustup: Add support for aarch64-unknown-linux-musl (alpine armv8)

Created on 18 Sep 2019  路  23Comments  路  Source: rust-lang/rustup

Cannot install rust on an arm based alpine linux distribution. In my case armv8 (64-bit). musl is only supported on x86.


It would be great to support the platform aarch64-unknown-linux-musl

fixed-next-release

Most helpful comment

With https://github.com/rust-lang/rust/pull/76420 these are now being built in CI. Dunno what's involved in making rustup aware of them, if anything.

All 23 comments

This looks like it ought to be possible, based on the platform support list. I guess someone needs to work out the right docker bits. Should be an easy contribution if you want to give it a go. I'm willing to help if someone shows up on our Discord too.

Thanks. I am pretty new to rust, however I will try and give it a stab.

I am currently using latest docker edge for the platform capability.

FROM balenalib/aarch64-alpine
# Install build tools
RUN apk add --no-cache build-base gcc pkgconfig curl file git openssl-dev 
ENV PATH=/root/.cargo/bin:$PATH
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y 
docker buildx build --platform linux/arm64 -t my/rust-image .

rustup-init.sh fails in get_bitness() as head -c 5 /proc/self/exe errors with Bad descriptor. Might need an alternative to getting bitness (32 or 64 bit) without dependencies.

There is no possibility to do it right now because aarch64-unknown-linux-musl is target only (does not provide cargo and rustc) because Rust does not have enough CI budget.

So it is :( I shall remove the easy/mentor tags for now, thanks @mati865

Thanks for the updates. Currently rust arm64 docker images are quite large. Cannot use alpine or build static as that requires musl. Hopefully this will get in the pipeline at some point.

Is this the sort of thing that would be enabled by the ongoing work to add aarch64 CI for Rust, and making it a T1 platform? (https://github.com/rust-lang/rfcs/pull/2959)

Probably; I can't imagine that rustup wouldn't be able to install a Tier 1 triple.

Actually, I guess I have a slightly more important question: Does this require an aarch64 builder, or could it be done in src/ci/docker/host-x86_64/dist-aarch64-linux/Dockerfile, which cross-compiles currently?

I'm happy to provide a PR in that case -- if this is just a case of CI budget, I think the move to GHA has addressed that.

(Ugh, I just realized this issue was on the rustup repo, and not the rust one)

Could someone please explain the path forward to get official arm binaries for rustup?
I suspect interest in arm will increase even more with Apple moving away from Intel.
Is it really just build minutes missing?

The platform has to be tier one or two, with the compiler and cargo available for the target before rustup can begin to be made available.

@kinnison Thanks for the quick response.

So IIUC from reading this:

https://doc.rust-lang.org/nightly/rustc/platform-support.html

cargo and rustc are not supported as host systems yet.

Maybe a stupid question: What needs to be done to get support for a host platform? I would have thought that's the easy part.

I think you need to talk to the compiler team for that.

https://github.com/rust-lang/rust/issues/75721 is probably a better ticket to track for this

With https://github.com/rust-lang/rust/pull/76420 these are now being built in CI. Dunno what's involved in making rustup aware of them, if anything.

First step would be to write support into our linux workflow template, regenerate the workflows with this new target enabled for PRs, and submit a PR to test if it builds.

Well, once it's proven out in CI, we then have to clean it up to only build it on the stable branch, get that PR merged, and then it'll turn up in the next release. It'd be worth checking that rustup-init.sh identifies the platform properly too, otherwise that'll fail.

Anyone working on this? Might give it a shot, but I have no experience with the rustup codebase. If anyone else is working on this or has more experience, I'll happily wait for them to finish it :smile:

To my knowledge, nobody is working on this yet.

This is implemented in #2493, right?

Yep, well spotted.

Rustup 1.23.0 is now out.

Was this page helpful?
0 / 5 - 0 ratings