termux / termux-api-package

Termux package containing scripts to call functionality in Termux:API.
MIT License
994 stars 314 forks source link

termux-api fails with a linker error #155

Closed igor725 closed 2 years ago

igor725 commented 2 years ago

Problem description termux-api binary not working at all in the proot container

Steps to reproduce

  1. termux-chroot bash
  2. /usr/libexec/termux-api
  3. Linker error occurs (Error preloading public library liblistenjni.qti.so, library not found)

Expected behavior termux-api doesn't throw an linker error, just like outside proot

Additional information

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=11206
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://mirror.surf/termux/termux-main/ stable main
Updatable packages:
All packages up to date
termux-tools version:
1.16
Android version:
12
Kernel build information:
Linux localhost 4.14.180-perf-gade833a #1 SMP PREEMPT Mon May 9 23:00:52 CST 2022 aarch64 Android
Device manufacturer:
Xiaomi
Device model:
M2102J20SG
Grimler91 commented 2 years ago

Doesn't seem like this has anything to do with termux-api. Something is trying to LD_PRELOAD liblistenjni.qti.so for some reason, and not finding it

igor725 commented 2 years ago

There is only libtermux-exec.so in the LD_PRELOAD. The thing is that I don't have liblistenjni.qti.so anywhere, neither in /system or /vendor, so I can't even add it to LD_LIBRARY_PATH. gdb says that termux-api hangs on __accept4 function.

Grimler91 commented 2 years ago

Seems like xiaomi should have it in /system_ext or something like that

Mixing proot libraries and android libraries is messy so not sure if we want to try to support termux-api for proot

igor725 commented 2 years ago

Oh, didn't notice this one. And yes, I found this library in /system_ext. I'll try to figure it out myself, thanks.

igor725 commented 2 years ago

Looks like mounting /system_ext fixes this issue. I didn't even have to change LD_LIBRARY_PATH, I just added ARGS="$ARGS -b /system_ext:/system_ext" to /usr/bin/termux-chroot and it worked.

Grimler91 commented 2 years ago

Great :+1: