Skip to content

feat(npm): add Android arm64 (Termux) support - #695

Merged
dmtrKovalenko merged 1 commit into
mainfrom
triage-bot/issue-692
Jul 20, 2026
Merged

dmtrKovalenko merged 1 commit into
mainfrom
triage-bot/issue-692

Conversation

@gustav-fff

Copy link
Copy Markdown
Collaborator

Closes #692

Root cause

@ff-labs/fff-node and @ff-labs/fff-bun declare os: [darwin, linux, win32], so npm rejects Android installs with EBADPLATFORM. Even with npm_config_force=true no binary resolves because TRIPLE_TO_NPM_PACKAGE has no aarch64-linux-android entry and getTriple() throws on process.platform === 'android'. CI already cross-compiles aarch64-linux-android (.github/workflows/release.yaml:182-187, 245-256) but the "Prepare npm package" and "Upload npm package artifact" steps were skipped, and no platform package existed.

Fix

  • New packages/fff-bin-android-arm64/ with os: [android], cpu: [arm64].
  • Map process.platform === 'android' → linux-android in getTriple() for both fff-node and fff-bun.
  • Add aarch64-linux-android → @ff-labs/fff-bin-android-arm64 in TRIPLE_TO_NPM_PACKAGE (both packages).
  • Add android to os and the new package to optionalDependencies in fff-node and fff-bun package.json.
  • Set npm_package: fff-bin-android-arm64 on the android matrix leg and unskip the prepare/upload steps in .github/workflows/release.yaml so the existing NDK build gets published.

Steps to reproduce

On Termux (Android arm64), on main before this fix:

pi install npm:@ff-labs/pi-fff
# npm error code EBADPLATFORM
# npm error notsup Unsupported platform for @ff-labs/fff-node@0.10.0:
#   wanted {"os":"darwin,linux,win32","cpu":"x64,arm64"}
#   (current: {"os":"android","cpu":"arm64"})

Workaround the reporter found (npm_config_force=true pi install npm:@ff-labs/pi-fff) bypasses the platform check but leaves resolveFromNpmPackage() returning null (packages/fff-node/src/binary.ts:68), so runtime dlopen still fails outside a dev workspace.

After this PR + first release cutting @ff-labs/fff-bin-android-arm64, the same command should succeed without --force, and findBinary() should return the libfff_c.so inside the android platform package.

How verified

  • npm run typecheck in packages/fff-node and packages/fff-bun — pass.
  • npm run build in packages/fff-node — pass.
  • CI android build path already existed and produced target/aarch64-linux-android/ci/libfff_c.so; only packaging wiring changed.
  • No runtime verification on-device — @dmtrKovalenko + @joaothallis, please dogfood a nightly on Termux before tagging a release; if ldd/dlopen of libfff_c.so against Bionic surfaces an unresolved symbol, we may need to adjust ffi-rs handling (Termux uses @yuuang/ffi-rs-android-arm64@1.3.2 which npm already selected in the reporter's log).

Automated triage via Gustav. Honk-Honk 🪿

Adds @ff-labs/fff-bin-android-arm64 platform package and wires the
existing aarch64-linux-android CI build into the npm publishing matrix.
Extends getTriple() in fff-node and fff-bun to map process.platform
'android' to linux-android, and adds android to os arrays with the new
optionalDependency. Closes #692.

@joaothallis joaothallis left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dmtrKovalenko
dmtrKovalenko merged commit 11a0d44 into main Jul 20, 2026
52 checks passed
abhijit-s pushed a commit to abhijit-s/fff that referenced this pull request Jul 21, 2026
Upstream 0.10.1 batch (5 commits): pi-fff fixes (install fff-bun dmtrKovalenko#689/dmtrKovalenko#694,
Windows cross-volume paths dmtrKovalenko#684), node/bun Android arm64 Termux support (dmtrKovalenko#695),
and the 0.10.1 release/version bumps. No Rust source changes reach the fork —
all JS-SDK/packaging/CI.

Conflicts (config only, no code):
- All crate Cargo.toml + workspace: take ours (fork stays 0.17.1; upstream's
  0.10.1 is its own release line). fff-mcp keeps daemon deps (fff-ipc/dirs/libc).
- install-mcp.sh: ours (fork installs from HEAD/source, not upstream release-pin).
- release.yaml: ours — keep the Android C-FFI matrix entry commented, consistent
  with the fork's policy of disabling non-macOS C builds to keep CI lean.
- Cargo.lock: ours (workspace unchanged vs f5db5c1).

Daemon rust verified intact (server.rs proxy path present); build-daemon green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Failing to install pi agent extension on Android

3 participants