2e3s / aw-watcher-media-player

Watcher of system's currently playing media for ActivityWatch
The Unlicense
21 stars 2 forks source link

Doesn't work on Ubuntu 20.04 #2

Closed Naereen closed 7 months ago

Naereen commented 7 months ago

Hi there, I was/am very interested in using this project. I tried to install it, following the guide, using either the .zip or the .deb file. I got the following issues:

With the .zip file:

2024-02-18 18:50:53 [INFO ]: Starting module aw-watcher-media-player  (aw_qt.manager:148)
/home/lilian/.local/bin/activitywatch/aw-watcher-media-player/aw-watcher-media-player: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory

I guess I could work around that issue by manually downloading all the required shared libraries (like libssl.so.3). But I find it quite weird to be dependent on this latest version, for your tool, when the official ActivityWatch tools all depend on libssl.so.1.1.

With the .deb file:

sudo dpkg --install aw-watcher-media-player_1.0.0-1_amd64.deb 
(Reading database ... 591106 files and directories currently installed.)
Preparing to unpack aw-watcher-media-player_1.0.0-1_amd64.deb ...
Unpacking aw-watcher-media-player (1.0.0-1) over (1.0.0-1) ...
dpkg: dependency problems prevent configuration of aw-watcher-media-player:
 aw-watcher-media-player depends on libssl3 (>= 3.0.0~~alpha1); however:
  Package libssl3 is not installed.
 aw-watcher-media-player depends on libc6 (>= 2.34); however:
  Version of libc6:amd64 on system is 2.31-0ubuntu9.14.

dpkg: error processing package aw-watcher-media-player (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 aw-watcher-media-player

This issue I understand: my system (Ubuntu 20.04 LTS) is too old for this binary to work, right?

Is there a way to solve this issue (other than upgrading my distro)?

Thanks in advance if you think about one.

Apparently wishing for OpenSSL v3+ was meant by the developpers (https://github.com/2e3s/aw-watcher-media-player/blob/main/.github/workflows/release.yml#L20). Regards, -- @Naereen

Naereen commented 7 months ago

I tried to build OpenSSL from source, and moved the resulting libssl.so.3 file in the same directory as the binary ./aw-watcher-media-player, I get the same error.

2e3s commented 7 months ago

Hello!

when the official ActivityWatch tools all depend on libssl.so.1.1

This crate requires OpenSSL3. Which is why I can't simply build a special binary for older systems without reimplementing the client, unfortunately.

I tried to build OpenSSL from source, and moved the resulting libssl.so.3 file in the same directory as the binary ./aw-watcher-media-player, I get the same error.

This is strange, I would expect it to work even without specifying LD_LIBRARY_PATH,

Naereen commented 7 months ago

Hi again @2e3s, Thanks for taking the time to reply, so quickly.

I managed to link the libssl.so.3 and libcrypto.so.3 libraries, using the command you suggested, but now I have:

$ LD_LIBRARY_PATH=$(pwd):$LD_LIBRARY_PATH ./aw-watcher-media-player
./aw-watcher-media-player: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./aw-watcher-media-player)
./aw-watcher-media-player: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./aw-watcher-media-player)
./aw-watcher-media-player: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./aw-watcher-media-player)

The three lines of errors are because I apparently have libc.so.6 available at three locations:

$ ls -larth /lib*/**/libc.so.6
lrwxrwxrwx 1 root root 12 nov.  22 14:32 /lib/x86_64-linux-gnu/libc.so.6 -> libc-2.31.so*
lrwxrwxrwx 1 root root 12 nov.  22 14:32 /lib/i386-linux-gnu/libc.so.6 -> libc-2.31.so*
lrwxrwxrwx 1 root root 12 nov.  22 14:32 /lib32/libc.so.6 -> libc-2.31.so*

So I guess I'm off compiling libc.so.6? But this could break other programs installed on my machine -- I won't take the risk (like upgrading to a recent Ubuntu, I don't have time now and am a bit afraid of doing so later on).

Naereen commented 7 months ago

The three lines of errors are most likely due to the fact that the aw-watcher-media-player binary requires a version between 2.32, 2.33 and 2.34. I tried to look for an Ubuntu or Debian package from which I could easily extract a working locally "droppable" version of libc.so.6, but found only 2.31 (the one I have, in Ubuntu focal 20.04), or 2.35 (in Ubuntu 22.04 jammy).

2e3s commented 7 months ago

Ah, rather than compiling libc, it makes sense to just recompile aw-watcher-media-player especially that you already compile alright. That's what I used to do not so long ago being on Ubuntu 21. I think it worked by sudo make install on OpenSSL3 and then installing libssl-dev out of box, then cargo build --release just worked IIRC.

Naereen commented 7 months ago

Using https://stackoverflow.com/a/52454710 I compiled locally the GLIBC_2.34 (glibc-2.34.9000 branch) version of the GLIBC. When launching the aw-watcher-media-player binary, now I have a segfault error.

I'll stop trying now, it's not reasonable to spend more time on this, even though I would have love to get some ActivityWatch visualizations of what music/videos I'm listening/watching! Regards. -- @Naereen

Naereen commented 7 months ago

I tried to build using cargo build --release but got this error:

cargo build --release
error: failed to parse manifest at `/home/lilian/.local/bin/activitywatch/aw-watcher-media-player/Cargo.toml`

Caused by:
  failed to parse the `edition` key

Caused by:
  this version of Cargo is older than the `2021` edition, and only supports `2015` and `2018` editions.

So I think the issue is quite similar: my old Ubuntu 20.04 has only Cargo 2020 or less, not Cargo 2021.

2e3s commented 7 months ago

I guess you've got it from repos, but rust/cargo distribution in Ubuntu should be really old and barely ever useful whatever you use. This and rustc is better to install with https://rustup.rs/ easy and intuitive ( https://www.rust-lang.org/tools/install ).

Naereen commented 7 months ago

Thanks again for the suggestion. I'll keep this AW plugin in mind if I ever upgrade my Ubuntu to 22.04 or a more recent version.

Naereen commented 7 months ago

Apparently I had cargo and rustc installed using RustUP.rs but still with a 2020 version. Weird, as I remember trying on Rust last summer.

2e3s commented 7 months ago

You might already know, just in case, rustup update should fix it. rustup override set stable inside the project if there is a different global setting.

Naereen commented 7 months ago

Wow building it worked! Yeepee! Now, I can I add visualizations of data extracted from the plugin on the ActivityWatch overview web page? I don't see documentation on that aspect (yet) in the README.

Naereen commented 7 months ago

I managed to verify that the buckets of data were correctly implemented (using http://localhost:5600/#/buckets/aw-watcher-media-player_MYMACHINENAME).

Naereen commented 7 months ago

There is no urgency what so ever in my last question, don't worry :smile_cat: . Thanks again for your help, and let's keep in touch if you need someone to help testing any new features regarding using this data for vizualisations in the AW overview page.

2e3s commented 7 months ago

This is also displayed in http://localhost:5600/#/timeline by the way, which is how I keep track of my data for the most pat. Thank you for your feature request with an example of another watcher with a visualization. I'll look into it after a couple other things.