Added info talking about how to compile the library yourself

Atomic-Bean 2021-01-11 11:51:35 +10:30
parent afdae53497
commit 85606672fa

@ -1,11 +1,26 @@
For the new v2 groups libsignal-service requires [libzkgroup](https://github.com/signalapp/zkgroup), a native (rust) library. The library needs to be compiled separately for each CPU architecture and operating system. The `.dylib` for macOS and the `.so` for unix systems can be bundled in the root of the `zkgroup-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.
# 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.
### 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:
- JDK
- gradle
- rust (Guide [here](https://www.rust-lang.org/tools/install))
Once everything is setup, navigate to the root of the zkgroup codebase and check the makefile to see if your platform is there (Eg. `mac_dylib` for mac). If it is, run `make [PLATFORM]`. If your platform isn't present, then run `make libzkgroup` instead.
### Using the new zkgroup lib file
Once you have your library file, it can be bundled in the root of the `zkgroup-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/zkgroup-java-*.jar libzkgroup.so
Then either download the pre-built lib file or compile (`make libzkgroup`) the latest [libzkgroup](https://github.com/signalapp/zkgroup/releases) for your system and put it in the 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.