From 7f4416ee073935f45e9823b6f70ba895b734ccb9 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 22 Jul 2024 10:03:00 -0700 Subject: [PATCH 1/5] Use MSVC for the Windows toolchain instead of MinGW Explicitly use MSVC to avoid the runtime dependencies that the default toolchain CMake is using is bringing in. Closes #454 --- .github/workflows/main.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d3d542f74..20b97cc7c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -133,11 +133,23 @@ jobs: run: ./ci/docker-build.sh ${{ matrix.artifact }} if: runner.os == 'Linux' - # Use a shorter build directory than the default on Windows to avoid - # hitting path length and command line length limits. See - # WebAssembly/wasi-libc#514 + # Setup the VS Developoer Prompt environment variables to explicitly use + # MSVC to compile LLVM as that avoids extra runtime dependencies + # msys/mingw might bring. + # + # As of 2024-07-22 this sha is the "v1" tag. + - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 + if: runner.os == 'Windows' - name: Build and test (Windows) run: | + # Delete a troublesome binary as recommended here + # https://github.com/ilammy/msvc-dev-cmd?tab=readme-ov-file#name-conflicts-with-shell-bash + rm /usr/bin/link + # Use a shorter build directory than the default on Windows to avoid + # hitting path length and command line length limits. See + # WebAssembly/wasi-libc#514. Despite using a different build directory + # though still move the `dist` folder to `build/dist` so the upload + # step below doesn't need a windows-specific hook. ./ci/build.sh C:/wasi-sdk mkdir build cp -r C:/wasi-sdk/dist build From 0d9127050ea4a9ac728f7f6df71d5f0417df1494 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 22 Jul 2024 12:53:02 -0500 Subject: [PATCH 2/5] Update .github/workflows/main.yml Co-authored-by: Andrew Brown --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 20b97cc7c..885b76b01 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -137,7 +137,7 @@ jobs: # MSVC to compile LLVM as that avoids extra runtime dependencies # msys/mingw might bring. # - # As of 2024-07-22 this sha is the "v1" tag. + # As of 2024-07-22 this sha is the "v1.13.0" tag. - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 if: runner.os == 'Windows' - name: Build and test (Windows) From d9a25b5f626f321b7f32ea660143afeef0c826de Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 22 Jul 2024 11:41:54 -0700 Subject: [PATCH 3/5] Specify MinSizeRel in `build.sh` Looks like MSVC defaults to "Debug" instead of an empty string to so the default logic which works for other compilers isn't kicking in here. --- ci/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/build.sh b/ci/build.sh index 6dc187c4a..09c92a35f 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -18,6 +18,7 @@ fi cmake -G Ninja -B $build_dir/toolchain -S . \ -DWASI_SDK_BUILD_TOOLCHAIN=ON \ + -DCMAKE_BUILD_TYPE=MinSizeRel \ "-DCMAKE_INSTALL_PREFIX=$build_dir/install" \ $WASI_SDK_CI_TOOLCHAIN_CMAKE_ARGS \ "-DLLVM_CMAKE_FLAGS=$WASI_SDK_CI_TOOLCHAIN_LLVM_CMAKE_ARGS" From c4006db56355327304552715895075c8cdb08299 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 23 Jul 2024 07:30:52 -0700 Subject: [PATCH 4/5] Don't persist ccache stats across runs --- .github/workflows/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 885b76b01..433991f9c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -110,6 +110,9 @@ jobs: echo WASI_SDK_CI_TOOLCHAIN_CMAKE_ARGS="$cmake_args" >> $GITHUB_ENV shell: bash + - name: Clear ccache statistics + run: ccache --zero-stats + # Add some extra installed software on each runner as necessary. - name: Setup `wasmtime` for tests uses: bytecodealliance/actions/wasmtime/setup@v1 From 0d894e1536fab48359943b6f53ac3d1f25f465a3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 23 Jul 2024 07:38:20 -0700 Subject: [PATCH 5/5] Move zeroing --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 433991f9c..29061f846 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -110,9 +110,6 @@ jobs: echo WASI_SDK_CI_TOOLCHAIN_CMAKE_ARGS="$cmake_args" >> $GITHUB_ENV shell: bash - - name: Clear ccache statistics - run: ccache --zero-stats - # Add some extra installed software on each runner as necessary. - name: Setup `wasmtime` for tests uses: bytecodealliance/actions/wasmtime/setup@v1 @@ -128,6 +125,9 @@ jobs: run: sudo apt install ccache if: runner.os == 'Linux' + - name: Clear ccache statistics + run: ccache --zero-stats + - name: Build and test (macOS) run: ./ci/build.sh if: runner.os == 'macOS'