Turasa / libsignal-service-java

GNU General Public License v3.0
37 stars 21 forks source link

Startup fails with message dlopen failed: library "libpthread.so.0" not found when started under termux/android #33

Open Louisonix opened 9 months ago

Louisonix commented 9 months ago

Problem description

When I try to start signal-cli under termux/android the application bails out with the following message:

WARN Manager - Failed to call libsignal-client: /data/data/com.termux/files/usr/tmp/12416138040285907917libsignal_jni.so: dlopen failed: library "libpthread.so.0" not found: needed by /data/data/com.termux/files/usr/tmp/12416138040285907917libsignal_jni.so in namespace (default) Missing required native library dependency: libsignal-client

System information

TERMUX_VERSION=0.118.0
Packages CPU architecture: aarch64
Android version: 13
Kernel version: 4.9 aarch64 Android
Device manufacturer: Google
Device model: Pixel 3a

Further information

Android embeds threading into libc (not GNU libc).

Is there any possible solution to fix the issue?

Louisonix commented 9 months ago

Well that just gave me the next error:

WARN Manager - Failed to call libsignal-client: /data/data/com.termux/files/usr/tmp/17210035431305557706libsignal_jni.so: dlopen failed: library "libgcc_s.so.1" not found: needed by /data/data/com.termux/files/usr/tmp/17210035431305557706libsignal_jni.so in namespace (default) Missing required native library dependency: libsignal-client

So I gave up and tried proot as a workaround.

With proot/debian on top of termux it is working fine, just make sure to inject aarch64 libsignal_jni.so (https://media.projektzentrisch.de/temp/signal-cli/) into libsignal-client-*.jar:

cd signal-cli-0.12.0/lib
wget https://media.projektzentrisch.de/temp/signal-cli/libsignal_jni_so0300_ubuntu2004_arm64.gz
gzip -d ./libsignal_jni_so0300_ubuntu2004_arm64.gz
mv libsignal_jni_so0300_ubuntu2004_arm64 libsignal_jni.so
zip -d libsignal-client-*.jar libsignal_jni.so
zip libsignal-client-*.jar  libsignal_jni.so
AsamK commented 9 months ago

You would need to recompile libsignal-client for android, I guess: https://github.com/AsamK/signal-cli/wiki/Provide-native-lib-for-libsignal Maybe it could also be extracted from the Signal-Android apk file.