actions-rust-lang / setup-rust-toolchain

Setup a specific Rust toolchain with extra features like problem matchers
MIT License
180 stars 32 forks source link

target: `x86_64-unknown-linux-musl` uses x86_64-unknown-linux-gnu host #25

Closed azzamsa closed 11 months ago

azzamsa commented 11 months ago

Hi.

I use the code below for my CI.

    strategy:
      fail-fast: false
      matrix:
        include:
          - { build: linux-gnu,  os: ubuntu-22.04, target: x86_64-unknown-linux-gnu    }
          - { build: linux-musl, os: ubuntu-22.04, target: x86_64-unknown-linux-musl   }
          - { build: win-gnu,    os: windows-2022, target: x86_64-pc-windows-gnu       }
          - { build: win-msvc,   os: windows-2022, target: x86_64-pc-windows-msvc      }
          - { build: win32-msvc, os: windows-2022, target: i686-pc-windows-msvc        }
          - { build: macos,      os: macos-12    , target: x86_64-apple-darwin         }

Other target works well, but musl.

commit-date: 2023-08-26
host: x86_64-unknown-linux-gnu
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 8.2.1-DEV (sys:0.4.65+curl-8.2.1 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u  30 May 2023

Unlike others, It still uses host: x86_64-unknown-linux-gnu and doesn't respect the target input.

    steps:
      - name: Checkout source code
        uses: actions/checkout@v4

      - uses: actions-rust-lang/setup-rust-toolchain@v1
        with:
          target: ${{ matrix.job.target }}

Any suggestions?

Thanks for actions-rust-lang/setup-rust-toolchain 🏅

jonasbb commented 11 months ago

The host toolchain is independent of the compile target. You see the same for the windows hosts, that the host toolchain is always the same for all the different targets. Your problem is not with the host toolchain, but that the correct target is not installed.

The log shows that you are not passing a target to the action. It should include a line like target: x86_64-unknown-linux-musl there.

Run actions-rust-lang/setup-rust-toolchain@v1
  with:
    toolchain: stable
    cache: true
    rustflags: -D warnings

Are you sure your matrix statement is correct ${{ matrix.job.target }}?

azzamsa commented 11 months ago

Are you sure your matrix statement is correct ${{ matrix.job.target }}?

Oh, my bad. I thought matrix.job.target and matrix.target will have the same result.