Turasa / libsignal-service-java

GNU General Public License v3.0
42 stars 22 forks source link

zkgroups.so on non-x86 platforms #24

Closed thefinn93 closed 3 years ago

thefinn93 commented 4 years ago

Hello! Thanks for all your work on libsignal and signal-cli. I'm been seeing user reports of issues loading zkgroups.so on non-x86 platforms. I see signal-cli got a few issues about this as well. Have you looked into fixing this at all? I saw that there is a temporary workaround in place for now.

AsamK commented 4 years ago

Hi, yeah I been seeing these issues as well. I've added the workaround to keep signal-cli working on those platforms, as long as signal-cli doesn't support v2 groups, this is good enough for me. I think to really resolve the issue the zkgroups library would need to be compiled for each platform separately. Another possibility would be to compile zkgroups to webassembly and run that using wasmer or something similar ...

Atomic-Bean commented 3 years ago

Sorry to bug you, but do you know the steps for compiling zkgroups.so for our own architecture/s? "signalapp" don't provide any instructions so I tried ./gradlew build, but it complains about android dependencies. The closest I can see is this but I don't know how to run that.

Edit: I also found this, but on the gradlew step it still complains about android (Despite me only adding a non-android target). The specific error is

* What went wrong:
A problem occurred configuring project ':ffi:android:exampleApp'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/PATH-TO-REPO/zkgroup/local.properties'.
thefinn93 commented 3 years ago

in the arm-builds branch of the signald there has been some progress. We have a CI that automatically builds the .so and inserts it into the jar. Haven't done a whole lot of testing, which is why it's currently unmerged. here is the CI file that does it.

Atomic-Bean commented 3 years ago

in the arm-builds branch of the signald there has been some progress. We have a CI that automatically builds the .so and inserts it into the jar. Haven't done a whole lot of testing, which is why it's currently unmerged. here is the CI file that does it.

Thanks, but leaves me more confused. Is signald an alternative to signal-cli or does signal-cli depend on signald for its daemon/dbus stuff? I'm rather new to this so I'm struggling to understand what I need to do/get to make v2 groups work.

thefinn93 commented 3 years ago

Ah, sorry, signald is another project that depends on this fork of libsignal, it's technically a fork of signal-cli but has slightly different goals. You should be able to use our zkgroup build and jar update procedure on signal-cli with no major changes.

Atomic-Bean commented 3 years ago

I've tried running the commands for the java11 aarch64 platform (Since I can only use 64-bit binaries (Because MacOS) and that's the closest thing I can see). I cloned the same version linked above and ran make installDist successfully, but tools/repackage-zkgroup.sh zkgroup/target/release/libzkgroup.so "0.7.0" says No prebuilt which seems to be because zkgroup/target/release/libzkgroup.so doesn't exist. I've never used ci's before so I'm probably missing an obvious step.

But also, once I have the compiled library, how do I tell programs like signal-cli where it is? Do I need to put the file somewhere special or do I modify the calling command to tell the program where it is?

EDIT: Oh, seems zkgroup's repo releases have the libs for multiple platforms (Including mine) in their latest release. I don't need the latest/master version so these will be fine for me. I'm still not sure what to do with the lib now that I have it so if you could tell me that would be much appreciated.

EDIT 2: I figured out how to turn the dylib + class files into a jar and figured out where to put it in the signal-cli project to get it to see the zkgroup stuff. I'm all good now, thanks for pointing me in the right direction :)

AsamK commented 3 years ago

I've added a wiki page to signal-cli, feel free to update/extend it :) https://github.com/AsamK/signal-cli/wiki/Provide-native-lib-for-libsignal