TERMUX:

see (login to phone using ssh)[ssh/README.md]

AArch64 Linux → Android (Termux) compatibility notes

On Android/Termux, native executables use Bionic, not glibc, and the dynamic linker is typically /system/bin/linker64. Termux’s execution environment is different enough that patching a glibc binary to use Android’s linker is usually not sufficient.

if we want to download a binnary we should check *-aarch64-unknown-linux-musl and maybe not work.

inspect

file ./bin
readelf -hW ./bin | grep Type:
readelf -lW ./bin | grep INTERP
readelf -dW ./bin | grep NEEDED

key rule

if we ckeck a musl binary ./bin and we get:

ARM64 + static + ET_EXEC + no INTERP

Native Android wants:

ARM64 + PIE (ET_DYN) + Android/bionic-compatible build

decision

casestatus
ET_DYN + INTERPpatchable
ET_DYN (static PIE)likely OK
ET_EXEC (static)❌ no fix if not musl
ET_EXEC (dynamic)❌ no fix
glibc-linked❌ incompatible

patch (dynamic PIE only)

set Android linker:

patchelf --set-interpreter /system/bin/linker64 ./bin

optional rpath (Termux libs):

patchelf --set-rpath '$PREFIX/lib' ./bin

failure patterns

  • Type: EXEC → non-PIE → rejected by linker
  • no INTERP → static → cannot patch
  • libc.so.6 → glibc → not present on Android
  • missing libs → bionic vs glibc ABI mismatch

tl;dr

  • want: ET_DYN (PIE)
  • avoid: ET_EXEC
  • musl > glibc, but must be PIE
  • patchelf only works for dynamic PIE binaries