Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions .ci/scripts/wheel/pre_build_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,41 @@ 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
# submodule clone failing due to path length limitations on Windows. Eventually,
# 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
git submodule update --init
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
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/build-wheels-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading