Skip to main content

The Core Problem

Android uses Bionic libc — a stripped-down libc optimized for mobile. Most Linux binaries (including the official Node.js release) are compiled against GNU glibc, which is incompatible with Bionic. Standard workarounds:
  • Proot/chroot: Runs a full Linux distro, heavy overhead
  • Termux Node.js build: Compiled against Bionic, but npm native modules often fail
  • OCA’s approach: Use glibc-runner to inject the real glibc linker at exec-time — no VM, no overhead

Layer Diagram


Key Components

glibc-runner (grun)

The glibc-runner Termux package provides a launcher that executes binaries with the real glibc dynamic linker. The OCA node wrapper calls:

glibc-compat.js

A Node.js preload script that polyfills Android-specific limitations:
  • os.cpus() — Android 12+ restricts CPU topology access
  • os.networkInterfaces() — may panic on restricted kernels

DNS Fix

Android 12+ removed /etc/resolv.conf. OCA writes $PREFIX/glibc/etc/resolv.conf:

File Structure

CLI tools: