GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: add Android/Termux support to postinstall.mjs by DEAD1nsane · Pull Request #48405 · anomalyco/opencode

Conversation

@DEAD1nsane

@DEAD1nsane DEAD1nsane commented Sep 11, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #47612

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The v2 CLI postinstall script fails on Termux/Android because os.platform() returns "android", which isn't in the platform map. This causes:

Error: OpenCode does not provide a binary for android-arm64

Two small changes fix this:

  1. Platform map (line 17): add android: "linux" so os.platform() resolves correctly on Termux
  2. isMusl() (line 83): return true on Android — Termux uses the musl binary with Alpine's musl loader via patchelf

The v2 musl binary already works on Android without modification. It only depends on libstdc++.so.6 and libc.musl-aarch64.so.1 — no Bun, no JSC, no WebKit.

How did you verify your code works?

Tested on Termux (Android 17, aarch64):

npm install -g @opencode-ai/cli@beta --force
opencode2 --version
# opencode2 v0.0.0-beta-19228

Without this change, the install fails with the EBADPLATFORM error above.

Screenshots / recordings

N/A — CLI change, no UI.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

IncubatorShokuhou and Baidaofu reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@DEAD1nsane
fix: add Android/Termux support to postinstall.mjs
4d1f819
- Add android:linux to platformMap so os.platform() resolves correctly on Termux
- Return true in isMusl() on Android since Termux uses musl binary + Alpine loader

The v2 npm install fails on Termux with:
  Error: OpenCode does not provide a binary for android-arm64

This is because os.platform() returns 'android' which isn't in the platform map.
The musl binary already works on Android — just needs platform detection fix.

Tested on Termux (Android aarch64):
  npm install -g @opencode-ai/cli@beta --force
  opencode2 --version
  # opencode2 v0.0.0-beta-19228

Fixes anomalyco#47612
@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on the search results, I found related PRs that may be worth reviewing:

  1. PR feat(opencode): add one-shot Termux bootstrap script and docs #41695 - feat(opencode): add one-shot Termux bootstrap script and docs

    • Related to Android/Termux support but appears focused on bootstrap tooling rather than postinstall
  2. PR feat: add Android/Termux support to postinstall, wrapper, and publish #33010 - feat: add Android/Termux support to postinstall, wrapper, and publish

    • Most relevant — This appears to be a previous attempt at adding Android/Termux support to postinstall. You should check if this was closed/abandoned or if there's a reason the current PR (48405) is needed separately.

Recommendation: Review PR #33010 to understand why a new fix is needed rather than reopening/updating that feature PR. The current PR #48405 is a fix rather than a feat, suggesting it may be addressing a regression or incomplete implementation from the earlier work.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DEAD1nsane

DEAD1nsane commented Sep 11, 2026

Copy link
Copy Markdown
Author

The following comment was made by an LLM, it may be inaccurate:

Based on the search results, I found related PRs that may be worth reviewing:

  1. PR feat(opencode): add one-shot Termux bootstrap script and docs #41695 - feat(opencode): add one-shot Termux bootstrap script and docs

    • Related to Android/Termux support but appears focused on bootstrap tooling rather than postinstall
  2. PR feat: add Android/Termux support to postinstall, wrapper, and publish #33010 - feat: add Android/Termux support to postinstall, wrapper, and publish

    • Most relevant — This appears to be a previous attempt at adding Android/Termux support to postinstall. You should check if this was closed/abandoned or if there's a reason the current PR (48405) is needed separately.

Recommendation: Review PR #33010 to understand why a new fix is needed rather than reopening/updating that feature PR. The current PR #48405 is a fix rather than a feat, suggesting it may be addressing a regression or incomplete implementation from the earlier work.

@anomalyco Thanks for the heads up. PR #33010 and this PR take different approaches:

PR #33010 (glibc approach): Uses grun (glibc-runner) to run the glibc-linked linux-arm64 binary on Termux. Requires installing glibc-runner from tur-repo, and the binary still goes through glibc under the hood.

PR #48405 (musl approach): Uses the linux-arm64-musl binary directly with Alpine's musl loader via patchelf. No glibc-runner needed — the binary runs natively against musl. Also fixes isMusl() to return true on Android so the correct package variant is selected.

The musl approach avoids the glibc dependency entirely and matches how the community has been running opencode on Termux (see DEAD1nsane/opencode-termux-musl). Both PRs add android:linux to the platform map — that part is identical.

If the maintainers prefer the glibc approach, I'd close this one. But the musl approach is simpler (no extra runtime dependency) and has been tested extensively on Android 17.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DEAD1nsane
Merge branch 'dev' into fix/android-termux-postinstall
e05f600
@DEAD1nsane

DEAD1nsane commented Sep 19, 2026

Copy link
Copy Markdown
Author

@anomalyco — all 4 checks are green and I've just updated the branch onto latest dev. This is ready for review whenever you have a moment.

To recap the musl vs glibc (#33010) distinction from my earlier reply: this PR uses the linux-arm64-musl binary directly (no glibc-runner dependency), fixes isMusl() to return true on Android, and adds android:linux to the platform map. Tested on Android 17 (Termux, aarch64). If you'd rather go the glibc route, happy to close this one — just say the word.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Lucas7X7

Lucas7X7 commented Oct 4, 2026

Copy link
Copy Markdown

One case the musl path doesn't cover: Play Store Termux.

That variant is deprecated, so it's usually written off. But it still runs a
native Bionic build. Verified on Play Store Termux (aarch64, API 34):
opencode --version returns 1.18.21, no glibc layer, no linker64 fallback
triggered. The only launcher step is preloading libtermux-exec.so via a
/proc/self/maps check when the shim isn't already loaded.

Not arguing for Bionic as the official route — just noting the case isn't in
the musl coverage.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DEAD1nsane

DEAD1nsane commented Oct 6, 2026

Copy link
Copy Markdown
Author

{
"body": "@Lucas7X7 Thanks for testing — useful data point, and agreed it's not a blocker for this PR.\n\nScope: the musl path targets current Termux (F-Droid/apt builds), where opencode-linux-arm64-musl + Alpine's musl loader via patchelf has been the community setup for a while (DEAD1nsane/opencode-termux-musl). The two-line change (android: \"linux\" in the platform map, isMusl() → true on Android) just makes npm install -g pick that path instead of failing with android-arm64 unsupported.\n\nOn Bionic: fair point that it's not covered — and it doesn't need to be here. Native bionic builds do work; I've source-compiled opencode v2.0.x against the Android Bun 1.4.2 toolchain (pure bionic ELF, no glibc/proot, TUI runs natively — noted in #47612). If maintainers want an official bionic route, the clean path is publishing a bionic-linked linux-arm64 variant and preferring it in packageNames() on Android — but that's a build/publish change, not a postinstall fix.\n\nPlay Store Termux specifically: that build is deprecated and effectively frozen, so I wouldn't gate on it either way.\n\nHappy to file a follow-up issue for official bionic binaries if there's interest — this PR stays the minimal unblock so fresh Termux installs stop failing.\n"
}

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DEAD1nsane
Merge branch 'dev' into fix/android-termux-postinstall
765b0d0
@DEAD1nsane DEAD1nsane mentioned this pull request Oct 6, 2026
[FEATURE]: Add android to v2 npm package supported OS for Termux compatibility #47612
Open
@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thdxr thdxr closed this Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Add android to v2 npm package supported OS for Termux compatibility

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@DEAD1nsane @Lucas7X7 @thdxr
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.