From 680a2fa2aaccb0b265d971a9dcec73c3a77ee50a Mon Sep 17 00:00:00 2001 From: Justin Ma Date: Mon, 23 Jun 2025 06:22:25 +0800 Subject: [PATCH] Add loongarch64-unknown-linux-musl build target (#16020) --- .github/workflows/nightly-build.yml | 4 ++++ .github/workflows/release-pkg.nu | 8 ++++++++ .github/workflows/release.yml | 3 +++ 3 files changed, 15 insertions(+) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 1370ac539a..5fdf3ef2ed 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -127,6 +127,7 @@ jobs: - armv7-unknown-linux-musleabihf - riscv64gc-unknown-linux-gnu - loongarch64-unknown-linux-gnu + - loongarch64-unknown-linux-musl include: - target: aarch64-apple-darwin os: macos-latest @@ -152,6 +153,8 @@ jobs: os: ubuntu-22.04 - target: loongarch64-unknown-linux-gnu os: ubuntu-22.04 + - target: loongarch64-unknown-linux-musl + os: ubuntu-22.04 runs-on: ${{matrix.os}} steps: @@ -179,6 +182,7 @@ jobs: uses: actions-rust-lang/setup-rust-toolchain@v1 # WARN: Keep the rustflags to prevent from the winget submission error: `CAQuietExec: Error 0xc0000135` with: + cache: false rustflags: '' - name: Setup Nushell diff --git a/.github/workflows/release-pkg.nu b/.github/workflows/release-pkg.nu index e4988edf69..0d78aff034 100755 --- a/.github/workflows/release-pkg.nu +++ b/.github/workflows/release-pkg.nu @@ -99,6 +99,14 @@ if $os in ['macos-latest'] or $USE_UBUNTU { $env.CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_LINKER = 'loongarch64-unknown-linux-gnu-gcc' cargo-build-nu } + 'loongarch64-unknown-linux-musl' => { + print $"(ansi g)Downloading LoongArch64 musl cross-compilation toolchain...(ansi reset)" + aria2c -q https://github.com/LoongsonLab/oscomp-toolchains-for-oskernel/releases/download/loongarch64-linux-musl-cross-gcc-13.2.0/loongarch64-linux-musl-cross.tgz + tar -xf loongarch64-linux-musl-cross.tgz + $env.PATH = ($env.PATH | split row (char esep) | prepend $'($env.PWD)/loongarch64-linux-musl-cross/bin') + $env.CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER = "loongarch64-linux-musl-gcc" + cargo-build-nu + } _ => { # musl-tools to fix 'Failed to find tool. Is `musl-gcc` installed?' # Actually just for x86_64-unknown-linux-musl target diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5167d93d33..728b5901c9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,6 +35,7 @@ jobs: - armv7-unknown-linux-musleabihf - riscv64gc-unknown-linux-gnu - loongarch64-unknown-linux-gnu + - loongarch64-unknown-linux-musl include: - target: aarch64-apple-darwin os: macos-latest @@ -60,6 +61,8 @@ jobs: os: ubuntu-22.04 - target: loongarch64-unknown-linux-gnu os: ubuntu-22.04 + - target: loongarch64-unknown-linux-musl + os: ubuntu-22.04 runs-on: ${{matrix.os}}