Android: build scripts for the collector and the async runtime - #507
Merged
Merged
Conversation
scripts/build_gc_release_android.bat and scripts/build_tslang_runtime_release_android.bat build Boehm and TypeScriptAsyncRuntime for Android API 29 (arm64-v8a and x86_64) with the NDK's CMake toolchain, from ANDROID_NDK_HOME. The runtime goes through the standalone tslang/runtime project, which needs no LLVM or MLIR libraries. tslang/runtime had drifted from lib/TypeScriptAsyncRuntime: it lacked AsyncGCThreads.cpp (GC_enable_threads, needed by every gc program that is linked against it) and ProcessHeap.cpp (__tslang_heap_*, which ProcessHeapPass makes Windows programs call). Both are back, for the x86 Windows build too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
Two local build scripts (Windows host, Android NDK) for the native pieces a program compiled with
-mtriple=<arch>-linux-android29links. Both take an ABI,arm64-v8aorx86_64, or build both when given none:scripts/build_gc_release_android.batbuilds Boehm gc 8.2.12 (static, PIC, threads) into3rdParty/gc/android/<abi>/release.scripts/build_tslang_runtime_release_android.batbuildslibTypeScriptAsyncRuntime.ainto__build/tslang-runtime/release/android/<abi>, through the standalonetslang/runtimeproject, which needs no LLVM or MLIR libraries.Both use the NDK's CMake toolchain with
ANDROID_PLATFORM=android-29, readANDROID_NDK_HOME, and need Ninja. Tested with NDK r30.The default library side is ASDAlexander77/TypeScriptCompilerDefaultLib, branch
android-build.Runtime project drift (affects x86 too)
tslang/runtime/CMakeLists.txtcompiled onlyAsyncRuntime.cppandDynamicRuntime.cpp. Since #412 and #419, the in-treelib/TypeScriptAsyncRuntimealso has:AsyncGCThreads.cpp:GC_enable_threads, which the entry point calls in everygcprogram.ProcessHeap.cpp:__tslang_heap_*, which ProcessHeapPass makes Windows programs call. It compiles to nothing off Windows.Both are added back. A Win32 build of the project now has
_GC_enable_threadsand___tslang_heap_mallocinTypeScriptAsyncRuntime.lib; before, the x86 library lacked them.Verification
MLIR_ASYNC_RUNTIME_EXPORTredefinition, which every non-Windows build ofAsyncRuntime.cppgets.assert, number to string,Date,async/await,fetch) was compiled withtslang -mtriple=<arch>-linux-android29 -relocation-model=pic. It was then linked with NDKclang++ -pie -static-libstdc++against these libraries and the Android default library. That ran for both ABIs, under gc, rc and none (release), and gc (debug):libc,libmandlibdlonly;GC_enable_threadsresolves under gc;GC_*.Not in this PR
tslang --emit=exefor Android still uses the Linux link line. It doesn't use the NDK sysroot or Android compiler-rt/libunwind, and it passes-lcurl,-lpthreadand-lrt, which Android doesn't have. Programs are linked with the NDK by hand for now (see the DefaultLib README).🤖 Generated with Claude Code