hoehermann / purple-signal

Pidgin/libpurple plugin for signal using libsignal-service-java (and parts of signal-cli).
GNU General Public License v3.0
24 stars 3 forks source link

Compilation instruction is somewhat unclear. #2

Closed fangfufu closed 2 years ago

fangfufu commented 3 years ago

Hi, I find it difficult to follow you compilation instruction under Linux (https://github.com/hoehermann/purple-signal/blob/master/INSTALL.md). Could you provide step-by-step command please?

hoehermann commented 3 years ago

The steps in detail:

git clone https://github.com/hoehermann/purple-signal.git
cd purple-signal
git submodule update --init
mkdir build
cd build
cmake ..
cmake --build .

To install, you can create links or copy the binaries (assumes a standard pidgin directory location):

cp c/libpurple-signal.so java/purple_signal.jar ~/.purple/plugins/
fangfufu commented 3 years ago

Ahh, there isn't a repository for https://github.com/hoehermann/purple-signal.git/signal-cli/

Here is the full log:

fangfufu@smithsonian:~/src/pidgin/purple-signal$ git submodule update --init
Submodule 'c/submodules/qrcode' (https://github.com/nayuki/QR-Code-generator) registered for path 'c/submodules/qrcode'
Submodule 'c/submodules/typedjni' (https://github.com/hoehermann/TypedJNI) registered for path 'c/submodules/typedjni'
Submodule 'java/submodules/signal-cli' (https://github.com/hoehermann/purple-signal.git/signal-cli) registered for path 'java/submodules/signal-cli'
Cloning into '/home/fangfufu/src/pidgin/purple-signal/c/submodules/qrcode'...
Cloning into '/home/fangfufu/src/pidgin/purple-signal/c/submodules/typedjni'...
Cloning into '/home/fangfufu/src/pidgin/purple-signal/java/submodules/signal-cli'...
remote: Not Found
fatal: repository 'https://github.com/hoehermann/purple-signal.git/signal-cli/' not found
fatal: clone of 'https://github.com/hoehermann/purple-signal.git/signal-cli' into submodule path '/home/fangfufu/src/pidgin/purple-signal/java/submodules/signal-cli' failed
Failed to clone 'java/submodules/signal-cli'. Retry scheduled
Cloning into '/home/fangfufu/src/pidgin/purple-signal/java/submodules/signal-cli'...
remote: Not Found
fatal: repository 'https://github.com/hoehermann/purple-signal.git/signal-cli/' not found
fatal: clone of 'https://github.com/hoehermann/purple-signal.git/signal-cli' into submodule path '/home/fangfufu/src/pidgin/purple-signal/java/submodules/signal-cli' failed
Failed to clone 'java/submodules/signal-cli' a second time, aborting
hoehermann commented 3 years ago

Whoops. This is the first time I actually used submodules in production. Obviously, I did something wrong. It should be https://github.com/hoehermann/signal-cli.git instead of https://github.com/hoehermann/purple-signal.git/signal-cli. Should be fixed now. Please try again. I am eager for your experience.

fangfufu commented 3 years ago

Compilation failed. Here is the log:

fangfufu@smithsonian:~/src/pidgin/purple-signal/build$ make
[  5%] Building Java objects for purple_signal.jar
submodules/signal-cli/src/main/java/org/asamk/signal/manager/Manager.java:419: error: incompatible types: boolean cannot be converted to Optional<SignalServiceMessagePipe>
                account.getDeviceId(), account.getSignalProtocolStore(), userAgent, account.isMultiDevice(), attachmentsV3, Optional.fromNullable(messagePipe), Optional.fromNullable(unidentifiedMessagePipe), Optional.absent(), clientZkProfileOperations, executor);
                                                                                                             ^
submodules/signal-cli/src/main/java/org/asamk/signal/manager/Manager.java:1188: error: method success in class SendMessageResult cannot be applied to given types;
            return SendMessageResult.success(recipient, unidentifiedAccess.isPresent(), false);
                                    ^
  required: SignalServiceAddress,boolean,boolean,long
  found: SignalServiceAddress,boolean,boolean
  reason: actual and formal argument lists differ in length
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors
make[2]: *** [java/CMakeFiles/purple_signal.dir/build.make:73: java/CMakeFiles/purple_signal.dir/java_compiled_purple_signal] Error 1
make[1]: *** [CMakeFiles/Makefile2:91: java/CMakeFiles/purple_signal.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
fangfufu@smithsonian:~/src/pidgin/purple-signal/build$ javac --version
javac 11.0.9

I am eager to get this version working. Hopefully it works better than libpurple-signald. I use libpurple-signald, but sometimes it fails silently incoming messages shows up as undisplayable images. I can't seem to reliably reproduce the problem, and I don't use it often enough to trigger it everyday. (I only have 1 friend on Signal)

hoehermann commented 3 years ago

I, too, have only few contacts on Signal. This plug-in is not well-tested at all. I expect it to work worse than purple-signald. However, I think this one has more potential to get better. ;)

It looks like I still got something wrong with the submodule. I want to look into it tonight or maybe next week.

fangfufu commented 3 years ago

Thanks, I am looking forward to your fixes. I myself wanted to write a pidgin plugin at one point, but the libpurple API looked really messy, and that put me off. Good luck! Please do reply to this issue when you have a fix, so I know when I can try compilation again. :)

hoehermann commented 3 years ago

It looks like you downloaded signal-cli 0.6.12. I was not even aware this new version exists (please bear with me – it is only nine days old). There was an incompatible change in the API. So as of today, this plug-in must be built against signal-cli 0.6.11 exactly. I improved the CMakeLists.txt so it checks the version.

sometimes [libpurple-signald] fails silently incoming messages shows up as undisplayable images.

Please be aware that this plug-in may actually be worse, as this line indicates. ;) Is is text-message only, for now.

Also, especially noticeable in case of linking, the contacts are not downloaded. You need to receive a message, then select "add buddy" from the conversation window to add the contact to Pidgin's local buddy list. In theory, you can also add a buddy using Pidgin's main window menu and then send them a message, but I never actually tried that.

I myself wanted to write a pidgin plugin at one point, but the libpurple API looked really messy, and that put me off.

I would not say "messy", but rather "very C". That is why I chose to implement the larger part of the C ↔ Java glue logic of this plug-in in C++. I never did anything like that before. It certainly is a learning experience. :)

fangfufu commented 3 years ago

It looks like you downloaded signal-cli 0.6.12. I was not even aware this new version exists (please bear with me – it is only nine days old).

That shouldn't stop the compilation, right? I thought you specify signal-cli version after launching the plugin. ;)

hoehermann commented 3 years ago

That shouldn't stop the compilation, right?

In this case, it does. I am building on top of signal-cli, re-defining two of it's classes SignalAccount and Manager. The Java compiler checks if my changes are still fine with the rest of signal-cli. https://github.com/Turasa/libsignal-service-java/commit/0ddf183 added a parameter to public static SendMessageResult success(…) which I do not yet use.

fangfufu commented 3 years ago

Okay, I got it compiled, and installed. The signal-cli jar's location should be set to /opt/signal-cli/lib rather than /opt/signal-cli.

Also, I can't see anyone of my contacts, is that to be expected?

hoehermann commented 3 years ago

Yes. I did not implement download of contacts, yet.

dchmelik commented 2 years ago

I had this problem; INSTALL.md's compilation instructions aren't just unclear but are incomplete, almost nonexistent. If one never used cmake nor with make may be days/weeks/months/years before figuring this out. When projects used cmake I used to just change my mind and not use them (until years later more used & wrote about it.)

hoehermann commented 2 years ago

I added a link to the build instructions to the main readme. This should make things more clear.

As for the use of cmake: This project targets Linux and win32 while using a mix of C, C++ and Java. cmake handles this situation incredibly well. If you happen to know any tool which does the job better and/or being more concise, I am open for suggestions. @dchmelik

hoehermann commented 2 years ago

Closing due to lack of response.

dchmelik commented 2 years ago

Yes: they're very unclear/incomplete: please update INSTALL.md

hoehermann commented 2 years ago

At the moment, is not possible to build this plug-in for win32 since recent versions of some dependencies are unavailable (and reportedly incompatible). Since I cannot even build the library, I can neither update the build instructions nor the installation instructions. I am sorry.

For Linux, there is libpurple-signald, which also is not in a good shape, but it works for me™.