Skip to content

feat: Add Android/Termux support#312

Open
kore4lyf wants to merge 1 commit into
asg017:mainfrom
kore4lyf:add-android-support
Open

feat: Add Android/Termux support#312
kore4lyf wants to merge 1 commit into
asg017:mainfrom
kore4lyf:add-android-support

Conversation

@kore4lyf

Copy link
Copy Markdown

Summary

Adds android-arm64 to the supported platforms list, enabling sqlite-vec to work on Termux (Android).

Problem

On Termux (Android), process.platform returns "android" instead of "linux", even though the device runs a Linux kernel. The current supportedPlatforms check rejects android-arm64, making sqlite-vec unusable on Termux.

The sqlite-vec-linux-arm64 prebuilt binary works on Android, but platformPackageName() needs to map androidlinux to resolve the correct package.

Changes

index.mjs

  1. Add android-arm64 to supportedPlatforms:
const supportedPlatforms = [
  ["darwin","x64"], ["linux","x64"], ["darwin","arm64"],
  ["win32","x64"], ["linux","arm64"], ["android","arm64"]
];
  1. Map android → linux in platformPackageName:
function platformPackageName(platform, arch) {
  let os = platform === "win32" ? "windows" : platform;
  if (os === "android") os = "linux";
  return `${BASE_PACKAGE_NAME}-${os}-${arch}`;
}
  1. Strip .so extension in load():
function load(db) {
  const p = getLoadablePath();
  db.loadExtension(p.replace(/\.so$/, ''));
}

(better-sqlite3's loadExtension() auto-appends .so, causing a double-extension error)

Testing

Tested on Termux Android ARM64 (Node v26.3.1):

getLoadablePath: .../sqlite-vec-linux-arm64/vec0.so
vec_version: {"vec_version()":"v0.1.9"}

Related

Notes

  • The sqlite-vec-linux-arm64 binary compiles and runs natively on Android/Termux
  • No new binary packages needed — reuses existing linux-arm64
  • The .so extension stripping is consistent with how other SQLite extensions handle better-sqlite3

- Add android-arm64 to supportedPlatforms
- Map android → linux in platformPackageName() (reuses linux-arm64 binary)
- Strip .so extension in load() for better-sqlite3 compatibility

Tested on Termux Android ARM64 (Node v26.3.1).
Closes asg017#68
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.

Tracking issue: Android Support

1 participant