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

Add loongarch64-unknown-linux-musl support #3921

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,9 @@ jobs:
- x86_64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- aarch64-linux-android
- aarch64-unknown-linux-gnu # skip-pr
- powerpc64-unknown-linux-gnu # skip-pr
- x86_64-unknown-linux-musl # skip-pr
- aarch64-unknown-linux-gnu # skip-pr
- powerpc64-unknown-linux-gnu # skip-pr
- x86_64-unknown-linux-musl # skip-pr
include:
- target: x86_64-unknown-linux-gnu
run_tests: YES
Expand Down Expand Up @@ -757,24 +757,24 @@ jobs:
- x86_64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- aarch64-linux-android
- aarch64-unknown-linux-gnu # skip-pr
- aarch64-unknown-linux-musl # skip-pr skip-master
- powerpc64-unknown-linux-gnu # skip-pr
- x86_64-unknown-linux-musl # skip-pr
- i686-unknown-linux-gnu # skip-pr skip-master
- arm-unknown-linux-gnueabi # skip-pr skip-master
- arm-unknown-linux-gnueabihf # skip-pr skip-master
- x86_64-unknown-freebsd # skip-pr skip-master
- x86_64-unknown-netbsd # skip-pr skip-master
- x86_64-unknown-illumos # skip-pr skip-master
- powerpc-unknown-linux-gnu # skip-pr skip-master
- powerpc64le-unknown-linux-gnu # skip-pr skip-master
- s390x-unknown-linux-gnu # skip-pr skip-master
- arm-linux-androideabi # skip-pr skip-master
- armv7-linux-androideabi # skip-pr skip-master
- x86_64-linux-android # skip-pr skip-master
- riscv64gc-unknown-linux-gnu # skip-pr skip-master
- loongarch64-unknown-linux-gnu # skip-pr skip-master
- aarch64-unknown-linux-gnu # skip-pr
- aarch64-unknown-linux-musl # skip-pr skip-master
- powerpc64-unknown-linux-gnu # skip-pr
- x86_64-unknown-linux-musl # skip-pr
- i686-unknown-linux-gnu # skip-pr skip-master
- arm-unknown-linux-gnueabi # skip-pr skip-master
- arm-unknown-linux-gnueabihf # skip-pr skip-master
- x86_64-unknown-freebsd # skip-pr skip-master
- x86_64-unknown-netbsd # skip-pr skip-master
- x86_64-unknown-illumos # skip-pr skip-master
- powerpc-unknown-linux-gnu # skip-pr skip-master
- powerpc64le-unknown-linux-gnu # skip-pr skip-master
- s390x-unknown-linux-gnu # skip-pr skip-master
- arm-linux-androideabi # skip-pr skip-master
- armv7-linux-androideabi # skip-pr skip-master
- x86_64-linux-android # skip-pr skip-master
- riscv64gc-unknown-linux-gnu # skip-pr skip-master
- loongarch64-unknown-linux-gnu # skip-pr skip-master
include:
- target: x86_64-unknown-linux-gnu
run_tests: YES
Expand Down
64 changes: 14 additions & 50 deletions ci/actions-templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,56 +27,20 @@ to S3 so that we can then make a release of rustup.

## Targets we need to build

We build for all the Tier one targets and a non-trivial number of the tier two
targets of Rust. We do not even attempt tier three builds.

We don't run the tests on all the targets because many are cross-built. If we
cross-build we don't run the tests. All the builds which aren't mac or windows
are built on an x86_64 system because that's the easiest way to get a performant
system.

| Target | Cross | Tier | On PR? | On master? |
| ----------------------------- | ---------- | ----- | ------ | ---------- |
| x86_64-unknown-linux-gnu | No | One | Yes | Yes |
| armv7-unknown-linux-gnueabihf | Yes | Two | Yes | Yes |
| aarch64-linux-android | Yes | Two | Yes | Yes |
| aarch64-unknown-linux-gnu | Yes | Two | No | Yes |
| aarch64-unknown-linux-musl | Yes | Two | No | Yes |
| powerpc64-unknown-linux-gnu | Yes | Two | No | Yes |
| x86_64-unknown-linux-musl | Yes | Two | No | Yes |
| i686-unknown-linux-gnu | Yes | One | No | No |
| arm-unknown-linux-gnueabi | Yes | Two | No | No |
| arm-unknown-linux-gnueabihf | Yes | Two | No | No |
| x86_64-unknown-freebsd | Yes | Two | No | No |
| x86_64-unknown-netbsd | Yes | Two | No | No |
| x86_64-unknown-illumos | Yes | Two | No | No |
| powerpc-unknown-linux-gnu | Yes | Two | No | No |
| powerpc64le-unknown-linux-gnu | Yes | Two | No | No |
| mips-unknown-linux-gnu | Yes | Two | No | No |
| mips64-unknown-linux-gnu | Yes | Two | No | No |
| mipsel-unknown-linux-gnu | Yes | Two | No | No |
| mips64el-unknown-linux-gnu | Yes | Two | No | No |
| s390x-unknown-linux-gnu | Yes | Two | No | No |
| arm-linux-androideabi | Yes | Two | No | No |
| armv7-linux-androideabi | Yes | Two | No | No |
| i686-linux-android | Yes | Two | No | No |
| x86_64-linux-android | Yes | Two | No | No |
| riscv64gc-unknown-linux-gnu | Yes | --- | No | No |
| loongarch64-unknown-linux-gnu | Yes | Two | No | No |
| ----------------------------- | ---------- | ----- | ------ | ---------- |
| aarch64-apple-darwin | Yes | Two | Yes | Yes |
| x86_64-apple-darwin | No | One | Yes | Yes |
| ----------------------------- | ---------- | ----- | ------ | ---------- |
| x86_64-pc-windows-msvc | No | One | Yes | Yes |
| x86_64-pc-windows-gnu | No | One | No | Yes |
| i686-pc-windows-msvc | No | One | No | No |
| i686-pc-windows-gnu | No | One | No | No |
| aarch64-pc-windows-msvc | Yes | Two | No | Yes |

We also have a clippy/shellcheck target which runs on x86_64 linux and is
run in all cases. It does a `cargo fmt` check, a `cargo clippy` check on the
beta toolchain, and also runs `rustup-init.sh` through to completion inside
a centos 6 docker to ensure that we continue to work on there OK.
We follow `rustc`'s [platform support policy] closely, and so `rustup` is expected
to build for all targets listed in the _tier 1_ or the _tier 2 with host tools_ section.

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

In order to reduce the maintainance burden, targets listed in the _tier 2 without host
tools_ section might get limited support, but should by no means become a blocker.
We should not build for targets listed in the _tier 3_ section, and if a target gets
downgraded to tier 3, its CI workflows should be dropped accordingly.

If a platform is directly supported by GitHub Action's free runners, we should always
build for it natively with the full test suite activated.
Otherwise, we might consider performing a cross-build, in which case we won't run the
tests for the the target.

## Useful notes about how we run builds

Expand Down
37 changes: 19 additions & 18 deletions ci/actions-templates/linux-builds-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,25 @@ jobs: # skip-master skip-pr skip-stable
- x86_64-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- aarch64-linux-android
- aarch64-unknown-linux-gnu # skip-pr
- aarch64-unknown-linux-musl # skip-pr skip-master
- powerpc64-unknown-linux-gnu # skip-pr
- x86_64-unknown-linux-musl # skip-pr
- i686-unknown-linux-gnu # skip-pr skip-master
- arm-unknown-linux-gnueabi # skip-pr skip-master
- arm-unknown-linux-gnueabihf # skip-pr skip-master
- x86_64-unknown-freebsd # skip-pr skip-master
- x86_64-unknown-netbsd # skip-pr skip-master
- x86_64-unknown-illumos # skip-pr skip-master
- powerpc-unknown-linux-gnu # skip-pr skip-master
- powerpc64le-unknown-linux-gnu # skip-pr skip-master
- s390x-unknown-linux-gnu # skip-pr skip-master
- arm-linux-androideabi # skip-pr skip-master
- armv7-linux-androideabi # skip-pr skip-master
- x86_64-linux-android # skip-pr skip-master
- riscv64gc-unknown-linux-gnu # skip-pr skip-master
- loongarch64-unknown-linux-gnu # skip-pr skip-master
- aarch64-unknown-linux-gnu # skip-pr
- aarch64-unknown-linux-musl # skip-pr skip-master
- powerpc64-unknown-linux-gnu # skip-pr
- x86_64-unknown-linux-musl # skip-pr
- i686-unknown-linux-gnu # skip-pr skip-master
- arm-unknown-linux-gnueabi # skip-pr skip-master
- arm-unknown-linux-gnueabihf # skip-pr skip-master
- x86_64-unknown-freebsd # skip-pr skip-master
- x86_64-unknown-netbsd # skip-pr skip-master
- x86_64-unknown-illumos # skip-pr skip-master
- powerpc-unknown-linux-gnu # skip-pr skip-master
- powerpc64le-unknown-linux-gnu # skip-pr skip-master
- s390x-unknown-linux-gnu # skip-pr skip-master
- arm-linux-androideabi # skip-pr skip-master
- armv7-linux-androideabi # skip-pr skip-master
- x86_64-linux-android # skip-pr skip-master
- riscv64gc-unknown-linux-gnu # skip-pr skip-master
- loongarch64-unknown-linux-gnu # skip-pr skip-master
- loongarch64-unknown-linux-musl # skip-pr skip-master skip-stable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm so you're saying that the CI should completely ignore this target as for now, if I'm not mistaken?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. If I'm not mistaken, rustup is currently only built with stable rustc. The first stable version of loongarch64-linux-musl will be 1.81, when skip-stable will be removed. Thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heiher I see. Thanks for the explanation!

Copy link
Member

@rami3l rami3l Oct 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heiher Are we ready for releasing this on stable now?

This should be the right time if possible, since we're releasing v1.28.0 beta very soon:

include:
- target: x86_64-unknown-linux-gnu
run_tests: YES
Expand Down
2 changes: 2 additions & 0 deletions ci/cloudfront-invalidation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ rustup/dist/i686-unknown-linux-gnu/rustup-init
rustup/dist/i686-unknown-linux-gnu/rustup-init.sha256
rustup/dist/loongarch64-unknown-linux-gnu/rustup-init
rustup/dist/loongarch64-unknown-linux-gnu/rustup-init.sha256
rustup/dist/loongarch64-unknown-linux-musl/rustup-init
rustup/dist/loongarch64-unknown-linux-musl/rustup-init.sha256
rustup/dist/mips-unknown-linux-gnu/rustup-init
rustup/dist/mips-unknown-linux-gnu/rustup-init.sha256
rustup/dist/mips64-unknown-linux-gnuabi64/rustup-init
Expand Down
4 changes: 4 additions & 0 deletions ci/docker/loongarch64-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM rust-loongarch64-unknown-linux-musl

ENV CC_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-gcc \
CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER=loongarch64-unknown-linux-musl-gcc
1 change: 1 addition & 0 deletions ci/fetch-rust-docker.bash
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ case "$TARGET" in
x86_64-unknown-netbsd) image=dist-x86_64-netbsd ;;
riscv64gc-unknown-linux-gnu) image=dist-riscv64-linux ;;
loongarch64-unknown-linux-gnu) image=dist-loongarch64-linux ;;
loongarch64-unknown-linux-musl) image=dist-loongarch64-musl ;;
*) exit ;;
esac

Expand Down
2 changes: 2 additions & 0 deletions doc/user-guide/src/installation/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ You can manually download `rustup-init` for a given target from
- [sha256 file](https://static.rust-lang.org/rustup/dist/i686-unknown-linux-gnu/rustup-init.sha256)
- [loongarch64-unknown-linux-gnu](https://static.rust-lang.org/rustup/dist/loongarch64-unknown-linux-gnu/rustup-init)
- [sha256 file](https://static.rust-lang.org/rustup/dist/loongarch64-unknown-linux-gnu/rustup-init.sha256)
- [loongarch64-unknown-linux-musl](https://static.rust-lang.org/rustup/dist/loongarch64-unknown-linux-musl/rustup-init)
- [sha256 file](https://static.rust-lang.org/rustup/dist/loongarch64-unknown-linux-musl/rustup-init.sha256)
- [mips-unknown-linux-gnu](https://static.rust-lang.org/rustup/dist/mips-unknown-linux-gnu/rustup-init)
- [sha256 file](https://static.rust-lang.org/rustup/dist/mips-unknown-linux-gnu/rustup-init.sha256)
- [mips64-unknown-linux-gnuabi64](https://static.rust-lang.org/rustup/dist/mips64-unknown-linux-gnuabi64/rustup-init)
Expand Down
5 changes: 5 additions & 0 deletions src/dist/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ const TRIPLE_X86_64_UNKNOWN_LINUX: &str = "x86_64-unknown-linux-musl";
const TRIPLE_AARCH64_UNKNOWN_LINUX: &str = "aarch64-unknown-linux-gnu";
#[cfg(all(not(windows), target_env = "musl"))]
const TRIPLE_AARCH64_UNKNOWN_LINUX: &str = "aarch64-unknown-linux-musl";
#[cfg(all(not(windows), not(target_env = "musl")))]
const TRIPLE_LOONGARCH64_UNKNOWN_LINUX: &str = "loongarch64-unknown-linux-gnu";
#[cfg(all(not(windows), target_env = "musl"))]
const TRIPLE_LOONGARCH64_UNKNOWN_LINUX: &str = "loongarch64-unknown-linux-musl";

// MIPS platforms don't indicate endianness in uname, however binaries only
// run on boxes with the same endianness, as expected.
Expand Down Expand Up @@ -503,6 +507,7 @@ impl TargetTriple {
} else {
TRIPLE_AARCH64_UNKNOWN_LINUX
}),
(b"Linux", b"loongarch64") => Some(TRIPLE_LOONGARCH64_UNKNOWN_LINUX),
(b"Darwin", b"x86_64") => Some("x86_64-apple-darwin"),
(b"Darwin", b"i686") => Some("i686-apple-darwin"),
(b"FreeBSD", b"x86_64") => Some("x86_64-unknown-freebsd"),
Expand Down
Loading