Skip to content

Use prebuilt static-MUSL skip binary target on Android hosts - #725

Open
hpr wants to merge 2 commits into
skiptools:mainfrom
hpr:android-host-binary
Open

Use prebuilt static-MUSL skip binary target on Android hosts#725
hpr wants to merge 2 commits into
skiptools:mainfrom
hpr:android-host-binary

Conversation

@hpr

@hpr hpr commented Aug 18, 2026

Copy link
Copy Markdown

Problem

Package.swift selects the skip transpiler like this:

  • #if os(macOS) → prebuilt macOS binary target
  • #elseif os(Linux) → prebuilt static-MUSL skip-linux.zip binary target
  • #else → build skipstone (+ SwiftSyntax) from source

Swift's compilation conditions treat Android as os(Android), not os(Linux), so on Android hosts (e.g. Termux/bionic) the manifest falls through to the #else branch and builds skipstone + SwiftSyntax 602 from source. That host build spikes 5–8 GB RSS in single swift-frontend processes, which OOM-kills typical Android devices.

Fix

Change the condition to #elseif os(Linux) || os(Android). The published static-MUSL skip binary itself runs fine on bionic (verified on-device, aarch64 Termux: skip version works via the binary target).

Companion PR

The published skip-linux.zip artifactbundle currently declares only *-unknown-linux-gnu in its info.json supportedTriples, so SwiftPM on an Android host still rejects the binary target ("Tool 'skip' is not supported on the target platform"). That list is generated by build_linux_plugin.sh at release time; skiptools/skipstone#266 adds the Android host triples (*-unknown-linux-android, *-unknown-linux-android24) so future releases work out of the box. (I verified the end-to-end flow by repacking the 1.9.5 skip-linux.zip with the Android triples added; swift build then picks the binary target and skipstone/SwiftSyntax leave the dependency graph entirely.)

Testing

This is a host-platform manifest condition, so there is no meaningful unit test for it (the repo's tests exercise the skip tool itself). Verified manually on-device (aarch64 Android/Termux, Swift 6.3.2 Android toolchain): with the condition fix + a triples-extended artifactbundle, swift build uses the prebuilt binary and no host SwiftSyntax build occurs.

os(Android) is distinct from os(Linux) in Swift compilation conditions,
so on Android hosts (e.g. Termux/bionic) the manifest fell through to
the else branch and built skipstone + SwiftSyntax from source. That
host build is enormous memory-wise and the static MUSL binary runs fine
on bionic, so use the binary target there too.
@cla-bot

cla-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to the Skip community. We require contributors to sign our contributor license agreement (CLA), and we don't seem to have the user(s) @hpr on file. In order for us to review and merge your code, for each noted user please add your GitHub username to Skip's .clabot file

@hpr

hpr commented Aug 18, 2026

Copy link
Copy Markdown
Author

recheck

@cla-bot cla-bot Bot added the cla-signed Automatically-added indication of a signed Contributor License Agreement label Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed Automatically-added indication of a signed Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant