ActivityWatch / aw-watcher-window-wayland

Window and AFK watcher for some Wayland compositors
Mozilla Public License 2.0
57 stars 14 forks source link

openssl error when building from source #20

Closed sethidden closed 1 year ago

sethidden commented 1 year ago

(just in case somebody runs into the same problem) When running the command from readme, I got the error that "Failed to find OpenSSL development" headers. The error message even tells you how to fix it, namely, running pacman -S openssl.

That did not work for me. What did, was pacman -S openssl-1.1 then running the build command like

 OPENSSL_LIB_DIR=/usr/lib/openssl-1.1/ OPENSSL_INCLUDE_DIR=/usr/include/openssl-1.1/ cargo build --release
sethidden commented 1 year ago

Hmm, it builds but I can't start it :thinking:

sway version 1.8

Same on aw-server, aw-server-rust, aw-qt

rt@hp400 /home/rt/dev/aw-watcher-window-wayland $ RUST_BACKTRACE=1 ./target/release/aw-watcher-window-wayland
### Setting up display
### Fetching wayland globals
### Setting up toplevel manager
### Setting up idle timeout
### Syncing roundtrip
### Preparing poll fds
### Taking client locks
### Creating aw-client
thread 'main' panicked at 'Failed to create window bucket: Error(Hyper(Error(Connect, Os { code: 107, kind: NotConnected, message: "Transport endpoint is not connected" })), "http://localhost:5600/api/0/buckets/aw-watcher-window_hp400")', src/main.rs:136:10
stack backtrace:
   0: rust_begin_unwind
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/panicking.rs:64:14
   2: core::result::unwrap_failed
             at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/result.rs:1791:5
   3: aw_watcher_window_wayland::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
varac commented 1 year ago

Ooh, right, I got the same error using the above build instructions, see #21

varac commented 1 year ago

@sethidden Did you eventually resolve this ?

sethidden commented 1 year ago

@varac Nope. I gave up :( Tried with aw-server-gtk, aw-server-rust and aw-server I guess you could try installing a version of the activitywatch rust client with a commit that matches when the original author had last commited code - https://github.com/ActivityWatch/aw-watcher-window-wayland/blob/master/Cargo.toml#L26 - perhaps it's "too new" now

ErikBjare commented 1 year ago

@johan-bjareholt Do you know?

johan-bjareholt commented 1 year ago

On the top of my head I don't know no, but like others have said, building with an older version of aw-client-rs and with "cargo build --locked" is worth trying. Updating the dependencies is probably also a good idea, was a while since last time.

ErikBjare commented 1 year ago

I just bumped openssl in aw-server-rust, might be related: https://github.com/ActivityWatch/aw-server-rust/pull/344

varac commented 1 year ago

I gave it a try again today, and could compile it without the need to export additional env vars like shown in the issue description. However, the main issue persists, after building and installing (rustc 1.67.0 (fc594f156 2023-01-24) (Arch Linux rust 1:1.67.0-2)) I can't start the watcher, it fails with the same error as mentioned in https://github.com/ActivityWatch/aw-watcher-window-wayland/issues/20#issuecomment-1407802022:

❯ aw-watcher-window-wayland
### Setting up display
### Fetching wayland globals
### Setting up toplevel manager
### Setting up idle timeout
### Syncing roundtrip
### Preparing poll fds
### Taking client locks
### Creating aw-client
thread 'main' panicked at 'Failed to create window bucket: Error(Hyper(Error(Connect, Os { code: 107, kind: NotConnected, message: "Transport endpoint is not connected" })), "http://localhost:5600/api/0/buckets/aw-watcher-window_zancas")', src/main.rs:136:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Which is weird because I can curl this endpoint:

❯ curl http://localhost:5600/api/0/buckets/aw-watcher-window_zancas
{"id":"aw-watcher-window_zancas","type":"currentwindow","client":"aw-watcher-window","hostname":"zancas","created":"2023-02-06T19:28:12.269456Z","data":{},"metadata":{"start":"2023-02-06T18:28:12.294Z","end":"2023-02-06T20:47:20.640Z"},"events":null,"last_updated":null}%  
varac commented 1 year ago

I'd like to try more, but I'm confused about the state of the different repos, and need some guidance here. This project's Cargo.toml includes this dependency:

aw_client_rust = { git = "https://github.com/ActivityWatch/aw-client-rust.git" }  

But this project is archived and show this

NOTE: This repo is deprecated and aw-client-rust now lives in [aw-server-rust](https://github.com/ActivityWatch/aw-server-rust/).

I'm not familiar with rust at at, could anyone please update this dependency in a way that it uses the current aw-server-rust repo please ?

ErikBjare commented 1 year ago

@johan-bjareholt Could you switch to the non-deprecated aw-client-rust?

johan-bjareholt commented 1 year ago

Was able to reproduce, updating the dependencies did the trick!

varac commented 1 year ago

@johan-bjareholt Awesome, it works with latest git now, thanks :white_flower: !