diff --git a/.ci/scripts/wheel/pre_build_script.sh b/.ci/scripts/wheel/pre_build_script.sh index bf48d3bc29f..365398d27a4 100755 --- a/.ci/scripts/wheel/pre_build_script.sh +++ b/.ci/scripts/wheel/pre_build_script.sh @@ -9,16 +9,13 @@ set -euxo pipefail # This script is run before building ExecuTorch binaries -if [[ "$(uname -m)" == "aarch64" ]]; then - # On some Linux aarch64 systems, the "atomic" library is not found during linking. - # To work around this, replace "atomic" with the literal ${ATOMIC_LIB} so the - # build system uses the full path to the atomic library. - file="extension/llm/tokenizers/third-party/sentencepiece/src/CMakeLists.txt" - sed 's/list(APPEND SPM_LIBS "atomic")/list(APPEND SPM_LIBS ${ATOMIC_LIB})/' \ - "$file" > "${file}.tmp" && mv "${file}.tmp" "$file" - - grep -n 'list(APPEND SPM_LIBS ${ATOMIC_LIB})' "$file" && \ - echo "the file $file has been modified for atomic to use full path" +# Initialize submodules here instead of during checkout so we can use OpenSSL +# on Windows (schannel fails with SEC_E_ILLEGAL_MESSAGE on some gitlab hosts). +UNAME_S=$(uname -s) +if [[ $UNAME_S == *"MINGW"* || $UNAME_S == *"MSYS"* ]]; then + git -c http.sslBackend=openssl submodule update --init +else + git submodule update --init fi # Clone nested submodules for tokenizers - this is a workaround for recursive @@ -26,7 +23,6 @@ fi # we should update the core job in test-infra to enable long paths before # checkout to avoid needing to do this. pushd extension/llm/tokenizers -UNAME_S=$(uname -s) if [[ $UNAME_S == *"MINGW"* || $UNAME_S == *"MSYS"* ]]; then git -c http.sslBackend=openssl submodule update --init else @@ -34,9 +30,20 @@ else fi popd +if [[ "$(uname -m)" == "aarch64" ]]; then + # On some Linux aarch64 systems, the "atomic" library is not found during linking. + # To work around this, replace "atomic" with the literal ${ATOMIC_LIB} so the + # build system uses the full path to the atomic library. + file="extension/llm/tokenizers/third-party/sentencepiece/src/CMakeLists.txt" + sed 's/list(APPEND SPM_LIBS "atomic")/list(APPEND SPM_LIBS ${ATOMIC_LIB})/' \ + "$file" > "${file}.tmp" && mv "${file}.tmp" "$file" + + grep -n 'list(APPEND SPM_LIBS ${ATOMIC_LIB})' "$file" && \ + echo "the file $file has been modified for atomic to use full path" +fi + # On Windows, enable symlinks and re-checkout the current revision to create # the symlinked src/ directory. This is needed to build the wheel. -UNAME_S=$(uname -s) if [[ $UNAME_S == *"MINGW"* || $UNAME_S == *"MSYS"* ]]; then echo "Enabling symlinks on Windows" git config core.symlinks true diff --git a/.github/workflows/build-wheels-windows.yml b/.github/workflows/build-wheels-windows.yml index 7fe6f880878..d1151e47b76 100644 --- a/.github/workflows/build-wheels-windows.yml +++ b/.github/workflows/build-wheels-windows.yml @@ -64,4 +64,7 @@ jobs: smoke-test-script: ${{ matrix.smoke-test-script }} trigger-event: ${{ github.event_name }} wheel-build-params: "--verbose" - submodules: true + timeout: 120 + # Submodules are initialized in pre_build_script.sh with OpenSSL to avoid + # schannel SSL errors on Windows when cloning from non-GitHub hosts. + submodules: false