在 Termux (Android aarch64) 上安装 OpenCode 的教程和一键脚本。
| 文件 | 说明 |
|---|---|
INSTALL-OPENCODE.md |
从零安装教程(原理、步骤、常见问题) |
install-opencode.sh |
一键安装脚本 |
curl -fsSL https://raw.githubusercontent.com/sinskl/opencode-termux-guide/main/install-opencode.sh | bash或手动安装:
pkg install glibc-repo
pkg update
pkg install glibc curl ripgrep
curl -fsSL https://opencode.ai/install | bash
cat > $PREFIX/bin/opencode << 'EOF'
#!/data/data/com.termux/files/usr/bin/sh
unset LD_PRELOAD
exec /data/data/com.termux/files/usr/glibc/lib/ld-linux-aarch64.so.1 "$HOME/.opencode/bin/opencode-linux-arm64" "$@"
EOF
chmod +x $PREFIX/bin/opencode官方 Linux ARM64 二进制依赖 glibc,Termux 使用 Android 的 bionic libc。解决方案:
- 安装 Termux 的
glibc包,提供ld-linux-aarch64.so.1 - 创建包装脚本:
unset LD_PRELOAD+ 通过 glibc 的动态链接器启动