Updated Provide native lib for libsignal (markdown)

AsamK 2021-01-31 12:05:25 +01:00
parent 2ec99b834b
commit ff09ec42ec

@ -1,12 +1,41 @@
The latest libsignal-service (NOT in a released signal-cli version yet) requires [libsignal-client](https://github.com/signalapp/libsignal-client), a native (rust) library, for the protocol implementation. Additionally for the new v2 groups libsignal-service requires [libzkgroup](https://github.com/signalapp/zkgroup), another native (rust) library.
You need to use the library files that are compiled for your CPU architecture and operating system.
Do note that signal-cli already comes pre-bundled with the linux x86_64 version of zkgroup and libsignal-service, so if you are on that platform then you should be able to use signal-cli with no issues.
# libsignal-client
### Building libsignal-client yourself
Go to the releases page and download the source for the libsignal-client version used by signal-cli.
You will need to install the following software:
- JDK
- gradle
- rust (Guide [here](https://www.rust-lang.org/tools/install))
Once everything is setup, navigate to the root of the libsignal-client codebase:
```sh
$ cd java
$ # Prevent building the android library
$ sed -i "s/, ':android'//" settings.gradle
$ ./build_jni.sh desktop
```
Then the native lib can be found in the libsignal-client root directory: `target/release/libsignal_jni.so`
### Using the new libsignal-client lib file
Once you have your library file, it can be bundled in the root of the `signal-client-java-*.jar` file (but only for one architecture at a time). Only if there is no bundled file will libsignal search the library path (`java.library.path`) for the `.dylib`/`.so`/`.dll` file.
The linux x86_64 version is bundled by default. For other systems, you need to remove the bundled lib from the jar file
zip -d build/install/signal-cli/lib/signal-client-java-*.jar libsignal_jni.so
# libzkgroup
For the new v2 groups libsignal-service requires [libzkgroup](https://github.com/signalapp/zkgroup), a native (rust) library. You need to use the library file that is compiled for your CPU architecture and operating system. There are already a few pre-compiled library files for a few popular platforms in the [releases](https://github.com/signalapp/zkgroup/releases) that can be downloaded. The `.dylib` is for macOS, the `.so` files are for linux systems and the `.dll` is for Windows. If you are on an architecture/OS that doesn't have a pre-built library (Such as the Raspberry Pi) then you'll need to compile the library yourself.
Do note that signal-cli already comes pre-bundled with the linux x86_64 version of zkgroup so if you are on that platform then you should be able to use signal-cli with no issues.
There are already a few pre-compiled library files for a few popular platforms in the [releases](https://github.com/signalapp/zkgroup/releases) that can be downloaded. The `.dylib` is for macOS, the `.so` files are for linux systems and the `.dll` is for Windows. If you are on an architecture/OS that doesn't have a pre-built library (Such as the Raspberry Pi) then you'll need to compile the library yourself.
### Building libzkgroup yourself
I recommend going to the releases page and downloading the source for the latest zkgroup build, just incase master is unstable. You will need to install the following software:
I recommend going to the releases page and downloading the source for the latest zkgroup build, just in case master is unstable. You will need to install the following software:
- JDK
- gradle
- rust (Guide [here](https://www.rust-lang.org/tools/install))
@ -21,6 +50,7 @@ The linux x86_64 version is bundled by default. For other systems, you need to r
zip -d build/install/signal-cli/lib/zkgroup-java-*.jar libzkgroup.so
## Library path
### Finding the default `java.library.path`
This [Java program](https://stackoverflow.com/a/20498049) can output any system property, including `java.library.path`. Note that there may be multiple paths to choose from, they are separated with a colon.