complete.c:2342:7: error: call to undeclared function 'setpwent'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
setpwent ();
^
The regular rl_username_completion_function body should probably be skipped on platforms without getpwent, not just for _WIN32 explicitly (patch attached). This would solve the issue on older Android versions.
But it doesn't actually solve the issue reported, which is due to a (imho) bug in Termux [1], where the default clang target doesn't have the same API level as that of libc, so some functions that are linkable are nevertheless not declared in headers unless the API level is overridden.