feat(litert): Windows-arm64 shared + Windows static-debug + Android-static (container)#3
Merged
Merged
Conversation
No upstream windows_arm64 prebuilt exists, so the shared lib must be built from source like the static leg. Add a self-contained Windows-arm64 shared path: same clang-cl + LLVM 20 woa64 + cpuinfo override + XNNPACK-off setup, but build the //litert/c:libLiteRt DLL cc_binary and synthesize its import lib (LiteRt.lib) from the exports. Adds the litert-windows-arm64-shared preset (source=build). Closes the last achievable archive gap vs the other engines (Android-static stays Bazel-blocked).
Match the other engines' Windows static Debug variant: Bazel -c dbg overrides
LiteRT's .bazelrc -c opt so objects link against the debug CRT (/MDd). Adds
litert-windows-{x86_64,arm64}-static-debug presets. With windows-arm64-shared,
this brings litert to 18 archives (Android-static remains Bazel-blocked).
A bare-runner Android Bazel build fails at the TF-workspace cuda_redist / rules_ml_toolchain external-load (no static prebuilt to fall back on). Run the build inside LiteRT's public ml-build container (which provisions those externals) via docker run: android-build.sh installs the NDK (r25b, per LiteRT's ci/tflite-android Dockerfile), configures the Android workspace, builds the C API impl closure for the ABI, and merges its transitive archives into libLiteRt.a. Adds the litert-android-arm64-v8a-static preset (arm64-v8a first to prove it).
- android-build.sh: point ANDROID_NDK_HOME directly at the extracted android-ndk-* dir (the prior ln -s glob failed: 'ln: target /android/ndk: No such file'). - LLVM 20 woa64 download: add curl --retry 5 --retry-all-errors (the windows-arm64-shared leg hit curl(23) write-error mid-download, likely Defender scanning the .exe; the identical static-debug install succeeded).
- android-build.sh: ANDROID_NDK_HOME via find -type d (the bare android-ndk-* glob also matched the .zip -> 'NDK missing at <dir> <zip>'). Got past the 530MB NDK download + unzip; this was the last blocker before the actual Bazel build. - stage.sh (both win-arm64 LLVM installs): download to llvm20.pkg then rename to .exe. curl(23) write-error persisted through all retries on the shared leg — Defender real-time-scanning the streaming .exe write; a non-.exe download dodges the race, the rename is atomic.
…download - android-build.sh: set TF_NEED_CLANG=1 + CLANG_COMPILER_PATH so configure.py doesn't error 'Invalid CLANG_COMPILER_PATH ... 10 times' in the ml-build container (which builds with clang). Now reaches the actual Bazel build. - stage.sh (both win-arm64 LLVM installs): download via PowerShell Invoke-WebRequest instead of curl — curl(23) 'error on write' flaked persistently on a WoA runner regardless of extension/retries.
… clang - win-arm64-shared: MSYS2_ARG_CONV_EXCL='*' was exported before the cpuinfo git clone, mangling its path (bazel: 'no such package @@cpuinfo, path does not exist'). Set it only just before the bazel build, after the clone + cygpath (mirrors why the static block works). The DLL build now reached 732+ targets. - android-build.sh: locate clang robustly (command -v / llvm-*/bin / apt install) instead of guessing /usr/lib/llvm-18 — base ml-build image's path differed, so CLANG_COMPILER_PATH was invalid and configure.py kept prompting.
The android-static docker run exited 2 with no container output — the ml-build image's ENTRYPOINT swallows the 'bash /android-build.sh' command. Override with --entrypoint bash and pass the script as the arg; add docker/version + script-ls diagnostics. (windows-arm64-shared now green; only android-static remains for 19.)
… add x86_64 + bundle The probe proved it: in the ml-build container with clang + Android NDK/SDK installed, the Bazel build clears the cuda_redist wall and produces a 34MB arm64 libLiteRt.a (379 archives merged). Port the recipe to the real leg (run the script directly — no entrypoint), add the android-x86_64-static ABI, and enable the multi-ABI static bundle (android_bundle_kinds += static) -> the Android-static archive. This closes the last gap: litert reaches 19.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the archive-count gap vs the other engines (litert 15 -> up to 19):
clang-cl + LLVM 20 + cpuinfo-override + XNNPACK-off setup as the static leg; synthesize the import lib.
cuda_redist/rules_ml_toolchain externals a bare runner lacks); NDK r25b, build + archive-merge.
Android-x86_64-static + the multi-ABI static bundle follow if the arm64 container leg works.