Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RISC-V platform support? #10883

Open
ifsheldon opened this issue Jan 23, 2025 · 9 comments · Fixed by #10937
Open

RISC-V platform support? #10883

ifsheldon opened this issue Jan 23, 2025 · 9 comments · Fixed by #10937
Labels
enhancement New feature or improvement to existing functionality

Comments

@ifsheldon
Copy link

Summary

As now RISC-V MCUs, dev boards and even servers get more and more popular, I'd really like to see uv support for RISC-V Linux platforms. There're officially supported RISC-V cpythons, so I think at least pure Python packages run fine on RISC-V machines. I think rustc can happily compile uv on RISC-V machines, but I don't know if there's anything else to get to the minimum support.

Example

No response

@ifsheldon ifsheldon added the enhancement New feature or improvement to existing functionality label Jan 23, 2025
@zanieb
Copy link
Member

zanieb commented Jan 23, 2025

I'm generally supportive of this. We added RISC-V builds to python-build-standalone. The first step is presumably a cross-build of uv in our release workflow.

@FishAlchemist
Copy link
Contributor

Current Rust Platform Support for RISC-V Linux

Tier 2 with Host Tools

target notes
riscv64gc-unknown-linux-gnu RISC-V Linux (kernel 4.20, glibc 2.29)
riscv64gc-unknown-linux-musl RISC-V Linux (kernel 4.20, musl 1.2.3)

Tier 3

target notes
riscv32gc-unknown-linux-gnu RISC-V Linux (kernel 5.4, glibc 2.33)
riscv32gc-unknown-linux-musl RISC-V Linux (kernel 5.4, musl 1.2.3 + RISCV32 support patches)

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

@konstin
Copy link
Member

konstin commented Jan 23, 2025

We already support risc-v for installing packages (#8934). For platforms without prebuilt binaries such as risc-v, you can install uv with cargo install --git https://github.com/astral-sh/uv uv. Please report anything that doesn't work on risc-v!

@ifsheldon
Copy link
Author

@konstin Thanks for the information. I didn't find it as I didn't search for PRs. cargo install works flawlessly, but I cannot install Python with uv.

Image

So, I guess I should make a feature request in https://github.com/astral-sh/python-build-standalone ? I don't know how hard it will be to build Python against, say, linux-riscv64gc-musl target, which should enable installing Python with uv.

@zanieb
Copy link
Member

zanieb commented Jan 24, 2025

The downloads use the riscv64 tag without the gc variant. I'll need to look into the differences to see what's appropriate.

@zanieb
Copy link
Member

zanieb commented Jan 24, 2025

The difference is that riscv64gc has the extra features needed to run Linux. (ie Mutiplication, Floats, Atomics, Fences and CSRs), as well as Compressed instructions (16-bit encodings).

rust-lang/rust-bindgen#2136

A little more detail; RISC-V is a modular ISA, meaning that it only has a mandatory base, and everything else is an extension. RV64GC is basically "RISC-V 64-bit, extensions G and C", with the G extension being a shorthand for some other extensions;

flatpak/flatpak#4594

Seems like we should change our builds to use the extended name? We'll discuss that upstream in astral-sh/python-build-standalone#504

@ifsheldon
Copy link
Author

the G extension being a shorthand for some other extensions

Yes, and I remember G actually means "general" in the sense of general computing.

We could probably follow Rust Platform Support, like supporting riscv64gc-unknown-linux-gnu and riscv64gc-unknown-linux-musl, since Tier 2 supported targets of Rust means there's meaningful amount of user interest so they are "guaranteed to build" while Tier 3 targets are supported with basically best efforts.

@ifsheldon
Copy link
Author

@zanieb Thanks!

I saw your commit 98e7cd0, so maybe you can add one more entry for building risc64gc-unknown-linux-musl target as well?

@zanieb zanieb reopened this Jan 25, 2025
@zanieb
Copy link
Member

zanieb commented Jan 25, 2025

Didn't mean to close this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants