diff --git a/.github/.cspell/organization-dictionary.txt b/.github/.cspell/organization-dictionary.txt index d7546a2..7244875 100644 --- a/.github/.cspell/organization-dictionary.txt +++ b/.github/.cspell/organization-dictionary.txt @@ -151,6 +151,7 @@ endianness esac euxo gsub +libc moreutils msys noninteractive diff --git a/.github/.cspell/project-dictionary.txt b/.github/.cspell/project-dictionary.txt index dcbdfa3..27ce2fc 100644 --- a/.github/.cspell/project-dictionary.txt +++ b/.github/.cspell/project-dictionary.txt @@ -5,7 +5,6 @@ CXXSTDLIB devel endgroup haswell -libc libclang libstdc Loongson @@ -19,5 +18,6 @@ WINEBOOT winehq WINEPATH WINEPREFIX +wineserver Zbuild Zdoctest diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1456243..1a8ccea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,6 @@ env: CARGO_NET_GIT_FETCH_WITH_CLI: true CARGO_NET_RETRY: 10 CARGO_TERM_COLOR: always - QEMU_STRACE: 1 RUST_BACKTRACE: 1 RUSTDOCFLAGS: -D warnings RUSTFLAGS: -D warnings @@ -184,7 +183,7 @@ jobs: # - { target: thumbv7a-pc-windows-msvc, os: windows-latest } # tier3 - { target: x86_64-pc-windows-msvc, os: windows-latest } - # Windows (GNU) + # Windows (MinGW) # rustup target list | grep -e '-pc-windows-gnu' # rustc --print target-list | grep -e '-pc-windows-gnu' # Windows host: @@ -194,13 +193,13 @@ jobs: os: windows-latest # Linux host: # - target: i686-pc-windows-gnu - # os: ubuntu-22.04 - target: x86_64-pc-windows-gnu - os: ubuntu-22.04 - target: x86_64-pc-windows-gnu runner: wine@7.13 - target: x86_64-pc-windows-gnu runner: wine@7.0.1 + - target: x86_64-pc-windows-gnullvm + - target: aarch64-pc-windows-gnullvm # prettier-ignore exclude: # Segmentation fault on ubuntu 20.04: https://github.com/taiki-e/setup-cross-toolchain-action/issues/1 @@ -220,6 +219,8 @@ jobs: persist-credentials: false - name: Install Rust run: rustup toolchain add nightly --no-self-update && rustup default nightly + - run: echo "QEMU_STRACE=1" >>"${GITHUB_ENV}" + if: matrix.target != 'aarch64-pc-windows-gnullvm' - uses: ./ with: target: ${{ matrix.target }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 955e946..df7ad4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,13 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com ## [Unreleased] +- Support windows-gnullvm targets on Linux host. + + - aarch64-pc-windows-gnullvm + - x86_64-pc-windows-gnullvm + + Running tests is supported on both targets. + ## [1.14.0] - 2023-07-28 - Support Windows targets on Windows host. diff --git a/README.md b/README.md index 6bbcc90..c929380 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,8 @@ GitHub Action for setup toolchains for cross compilation and cross testing for R - [FreeBSD](#freebsd) - [NetBSD](#netbsd) - [WASI](#wasi) - - [Windows (GNU)](#windows-gnu) + - [Windows (MinGW)](#windows-mingw) + - [Windows (LLVM MinGW)](#windows-llvm-mingw) - [Windows (MSVC)](#windows-msvc) - [macOS](#macos) - [Related Projects](#related-projects) @@ -367,23 +368,21 @@ Only specifying a major version is supported. ### WASI -| C++ | test | -| --- | ---- | -| ? (libc++) | ✓ | +| libc | Clang | C++ | test | +| ---- | ----- | --- | ---- | +| wasi-sdk 20 (wasi-libc 1dfe5c3) | 16.0.0 | ? (libc++) | ✓ | + + **Supported targets**: | target | host | runner | note | | ------ | ---- | ------ | ---- | -| `wasm32-wasi` | x86_64 Linux [1] | wasmtime | | - - +| `wasm32-wasi` | x86_64 Linux | wasmtime | | -[1] clang 14, wasi-sdk 16 (wasi-libc 30094b6)
- -### Windows (GNU) +### Windows (MinGW) | C++ | test | | --- | ---- | @@ -413,6 +412,19 @@ You can select/pin the version by using `@` syntax in `runner` input option. For runner: wine@7.13 ``` +### Windows (LLVM MinGW) + +| libc | Clang | C++ | test | +| ---- | ----- | --- | ---- | +| Mingw-w64 b190082 | 16.0.6 | ✓ (libc++) | ✓ | + +**Supported targets**: + +| target | host | runner | note | +| ------ | ---- | ------ | ---- | +| `aarch64-pc-windows-gnullvm` | Ubuntu (22.04) | wine | | +| `x86_64-pc-windows-gnullvm` | Ubuntu (22.04) | wine | | + ### Windows (MSVC) | C++ | test | diff --git a/main.sh b/main.sh index 4e23dd1..4949473 100755 --- a/main.sh +++ b/main.sh @@ -110,6 +110,12 @@ install_rust_cross_toolchain() { retry docker create --name rust-cross-toolchain "ghcr.io/taiki-e/rust-cross-toolchain:${target}${sys_version:-}-dev-amd64" mkdir -p .setup-cross-toolchain-action-tmp docker cp "rust-cross-toolchain:/${target}" .setup-cross-toolchain-action-tmp/toolchain + case "${target}" in + aarch64-pc-windows-gnullvm) + docker cp "rust-cross-toolchain:/opt/wine-arm64" .setup-cross-toolchain-action-tmp/wine-arm64 + sudo cp -r .setup-cross-toolchain-action-tmp/wine-arm64 /opt/wine-arm64 + ;; + esac docker rm -f rust-cross-toolchain >/dev/null sudo cp -r .setup-cross-toolchain-action-tmp/toolchain/. "${toolchain_dir}"/ rm -rf ./.setup-cross-toolchain-action-tmp @@ -235,8 +241,9 @@ register_binfmt() { local magic='MZ' local mask='' ;; - *) bail "internal error: unrecognized register_binfmt arg" ;; + *) bail "internal error: unrecognized register_binfmt argument '$1'" ;; esac + echo "Setting ${runner_path} as binfmt interpreter for ${target}" echo ":${target}:M::${magic}:${mask}:${runner_path}:F" \ | sudo tee /proc/sys/fs/binfmt_misc/register >/dev/null echo "::endgroup::" @@ -381,82 +388,112 @@ EOF runner_path="${toolchain_dir}/bin/${target}-runner" register_binfmt wasmtime ;; - x86_64-pc-windows-gnu) + x86_64-pc-windows-gnu | x86_64-pc-windows-gnullvm | aarch64-pc-windows-gnullvm) arch="${target%%-*}" - apt_target="${arch}-w64-mingw32" - apt_packages+=("g++-mingw-w64-${arch/_/-}") - sysroot_dir="/usr/${apt_target}" + case "${target}" in + *-gnullvm*) install_rust_cross_toolchain ;; + *) + apt_target="${arch}-w64-mingw32" + apt_packages+=("g++-mingw-w64-${arch/_/-}") + sysroot_dir="/usr/${apt_target}" + cat >>"${GITHUB_ENV}" <"${runner_path}" <".${target}-runner.tmp" </dev/null + ${wineboot} &>/dev/null touch /tmp/WINEBOOT fi -export WINEPATH="/usr/lib/gcc/${apt_target}/${gcc_lib};/usr/${apt_target}/lib;\${WINEPATH:-}" -exec wine "\$@" +export WINEPATH="${winepath};\${WINEPATH:-}" +exec ${wine_exe} "\$@" EOF - chmod +x "${runner_path}" + chmod +x ".${target}-runner.tmp" + sudo mv ".${target}-runner.tmp" "${runner_path}" register_binfmt wine - - cat >>"${GITHUB_ENV}" <