From ca475951a8c7ce83a83fd4ab805c0baae01b180f Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 15 Jul 2024 14:08:09 -0700 Subject: [PATCH] Try to avoid path length limits on Windows --- .github/workflows/main.yml | 8 ++++++-- ci/build.sh | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0b3abe6..5445d02 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -119,9 +119,13 @@ jobs: if: runner.os == 'Linux' # Use a shorter build directory than the default on Windows to avoid - # hitting path length and command line length limits. + # hitting path length and command line length limits. See + # WebAssembly/wasi-libc#514 - name: Build and test (Windows) - run: ./ci/build.sh C:/wasi-sdk + run: | + ./ci/build.sh C:/wasi-sdk + mkdir build + cp -r C:/wasi-sdk/build/dist build shell: bash if: runner.os == 'Windows' diff --git a/ci/build.sh b/ci/build.sh index f391e8a..6dc187c 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -11,19 +11,19 @@ set -ex # Optionally allow the first argument to this script to be the install # location. if [ "$1" = "" ]; then - install_dir=`pwd`/build/install + build_dir=`pwd`/build else - install_dir="$1" + build_dir="$1" fi -cmake -G Ninja -B build/toolchain -S . \ +cmake -G Ninja -B $build_dir/toolchain -S . \ -DWASI_SDK_BUILD_TOOLCHAIN=ON \ - "-DCMAKE_INSTALL_PREFIX=$install_dir" \ + "-DCMAKE_INSTALL_PREFIX=$build_dir/install" \ $WASI_SDK_CI_TOOLCHAIN_CMAKE_ARGS \ "-DLLVM_CMAKE_FLAGS=$WASI_SDK_CI_TOOLCHAIN_LLVM_CMAKE_ARGS" -ninja -C build/toolchain install dist -v +ninja -C $build_dir/toolchain install dist -v -mv build/toolchain/dist build/dist +mv $build_dir/toolchain/dist $build_dir/dist if [ "$WASI_SDK_CI_SKIP_SYSROOT" = "1" ]; then exit 0 @@ -31,19 +31,19 @@ fi # Use the just-built toolchain and its `CMAKE_TOOLCHAIN_FILE` to build a # sysroot. -cmake -G Ninja -B build/sysroot -S . \ - "-DCMAKE_TOOLCHAIN_FILE=$install_dir/share/cmake/wasi-sdk.cmake" \ +cmake -G Ninja -B $build_dir/sysroot -S . \ + "-DCMAKE_TOOLCHAIN_FILE=$build_dir/install/share/cmake/wasi-sdk.cmake" \ -DCMAKE_C_COMPILER_WORKS=ON \ -DCMAKE_CXX_COMPILER_WORKS=ON \ -DWASI_SDK_INCLUDE_TESTS=ON \ - "-DCMAKE_INSTALL_PREFIX=$install_dir" -ninja -C build/sysroot install dist -v + "-DCMAKE_INSTALL_PREFIX=$build_dir/install" +ninja -C $build_dir/sysroot install dist -v -mv build/sysroot/dist/* build/dist +mv $build_dir/sysroot/dist/* $build_dir/dist if [ "$WASI_SDK_CI_SKIP_TESTS" = "1" ]; then exit 0 fi # Run tests to ensure that the sysroot works. -ctest --output-on-failure --parallel 10 --test-dir build/sysroot/tests +ctest --output-on-failure --parallel 10 --test-dir $build_dir/sysroot/tests