Updated Provide native lib for libsignal (markdown)

Sebastian Scheibner 2025-12-26 13:24:29 +01:00
parent 8e5df9f3ee
commit 89977947df

@ -60,26 +60,24 @@ So the required libsignal-client version is `0.15.0`.
Once everything is setup, navigate to the root of the libsignal-client codebase:
```sh
$ cd java
$ # Prevent building the android library
$ sed -i "s/include ':android'//" settings.gradle
$ ./build_jni.sh desktop
```
Then the native lib can be found in the libsignal-client sub-directory: `target/release/libsignal_jni.so` (the file extension will be `.dylib` on MacOS and `.dll` on Windows, instead of `.so`).
Then the native lib can be found in the folder: `client/src/main/resources/libsignal_jni_amd64.so` (amd64 is architecture specific and the file extension will be `.dylib` on MacOS and `.dll` on Windows, instead of `.so`).
### Using the new libsignal-client lib file
Once you have your library file, it can be bundled in the root of the `libsignal-client-*.jar` file (but only for one architecture at a time).
Once you have your library file, it can be bundled in the root of the `libsignal-client-*.jar` file.
First, the currently bundled file needs to be removed:
zip -d signal-cli/lib/libsignal-client-*.jar libsignal_jni.so
zip -d signal-cli/lib/libsignal-client-*.jar libsignal_jni_amd64.so
For signal-cli to be able to use the newly compiled library file, it can either be bundled into the `.jar` file with
zip signal-cli/lib/libsignal-client-*.jar libsignal_jni.so
zip signal-cli/lib/libsignal-client-*.jar libsignal_jni_amd64.so
or be placed on the Java library path (see below). Only if there is no bundled file will libsignal search the library path (`java.library.path`) for the `.dylib`/`.so`/`.dll` file.
or be placed on the Java library path (see below). For this the file needs to be renamed to `libsignal_jni.so`. Only if there is no bundled file will libsignal search the library path (`java.library.path`) for the `.dylib`/`.so`/`.dll` file.
Note: on Windows, bundling the compiled `signal_jni.dll` file does not seem to work: see [#517](https://github.com/AsamK/signal-cli/issues/517). (According a [comment](https://github.com/AsamK/signal-cli/issues/517#issuecomment-894677266) in that thread, bundling does work if the files are renamed).