ActivityWatch / aw-qt

Tray icon that manages ActivityWatch processes, built with Qt.
Mozilla Public License 2.0
27 stars 29 forks source link

"Open Dashboard/API Browser" not working when packaged with PyInstaller #20

Closed johan-bjareholt closed 4 years ago

johan-bjareholt commented 7 years ago

When running aw-qt, the "Open Dashboard" and "Open API Browser" buttons fail to open the browser. When running aw-qt from source on the latest master it works fine though.

This part seems to be the cause

/usr/lib/firefox/firefox: /home/johan/Downloads/activitywatch/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/firefox/firefox)

Here are the full logs

Opening dashboard
/usr/lib/firefox/firefox: /home/johan/Downloads/activitywatch/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/firefox/firefox)
/usr/bin/xdg-open: line 854: x-www-browser: command not found
/usr/lib/firefox/firefox: /home/johan/Downloads/activitywatch/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/firefox/firefox)
/usr/bin/xdg-open: line 854: iceweasel: command not found
/usr/bin/xdg-open: line 854: seamonkey: command not found
/usr/bin/xdg-open: line 854: mozilla: command not found
/usr/bin/xdg-open: line 854: epiphany: command not found
/usr/bin/xdg-open: line 854: konqueror: command not found
/usr/bin/xdg-open: line 854: chromium: command not found
/usr/bin/xdg-open: line 854: chromium-browser: command not found
/usr/bin/xdg-open: line 854: google-chrome: command not found
/usr/bin/xdg-open: line 854: www-browser: command not found
/usr/bin/xdg-open: line 854: links2: command not found
/usr/bin/xdg-open: line 854: elinks: command not found
/usr/bin/xdg-open: line 854: links: command not found
/usr/bin/xdg-open: line 854: lynx: command not found
/usr/bin/xdg-open: line 854: w3m: command not found
xdg-open: no method available for opening 'http://localhost:5600'
Opening api browser
/usr/lib/firefox/firefox: /home/johan/Downloads/activitywatch/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/firefox/firefox)
/usr/bin/xdg-open: line 854: x-www-browser: command not found
/usr/lib/firefox/firefox: /home/johan/Downloads/activitywatch/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/firefox/firefox)
/usr/bin/xdg-open: line 854: iceweasel: command not found
/usr/bin/xdg-open: line 854: seamonkey: command not found
/usr/bin/xdg-open: line 854: mozilla: command not found
/usr/bin/xdg-open: line 854: epiphany: command not found
/usr/bin/xdg-open: line 854: konqueror: command not found
/usr/bin/xdg-open: line 854: chromium: command not found
/usr/bin/xdg-open: line 854: chromium-browser: command not found
/usr/bin/xdg-open: line 854: google-chrome: command not found
/usr/bin/xdg-open: line 854: www-browser: command not found
/usr/bin/xdg-open: line 854: links2: command not found
/usr/bin/xdg-open: line 854: elinks: command not found
/usr/bin/xdg-open: line 854: links: command not found
/usr/bin/xdg-open: line 854: lynx: command not found
/usr/bin/xdg-open: line 854: w3m: command not found
xdg-open: no method available for opening 'http://localhost:5600/api'
ErikBjare commented 7 years ago

Hmm, so looks like it tries to use the libstdc++ bundled by PyInstaller instead of the system libstdc++ when starting firefox. Perhaps we should use something else than the webbrowser module in the standard library.

Edit: Looks like this could be the issue (LD_LIBRARY_PATH is set by PyInstaller which leads to precedence of the bundled libstdc++).

ErikBjare commented 6 years ago

Just tried it with the v0.7.0b2 build. Seems to work fine on my laptop but it's possible that the bug is Arch or Firefox specific. Can you replicate with the v0.7.0b2 build Johan?

johan-bjareholt commented 6 years ago

Just downloaded 0.7.0b2, still the same issue and exactly the same logs sadly.

ErikBjare commented 6 years ago

Hmm... Can you try setting chrome as your default browser and see what happens?

Edit: Just noticed you don't have it installed as its tried as a fallback, still curious if it'd work.

johan-bjareholt commented 6 years ago

Seems to be other errors in that case.

Opening dashboard
/opt/google/chrome/google-chrome: /home/johan/Downloads/activitywatch/libdbus-1.so.3: no version information available (required by /usr/lib/libgconf-2.so.4)
/opt/google/chrome/google-chrome: /home/johan/Downloads/activitywatch/libdbus-1.so.3: no version information available (required by /usr/lib/libdbus-glib-1.so.2)
/opt/google/chrome/chrome: /home/johan/Downloads/activitywatch/libdbus-1.so.3: no version information available (required by /usr/lib/libgconf-2.so.4)
/opt/google/chrome/chrome: /home/johan/Downloads/activitywatch/libdbus-1.so.3: no version information available (required by /usr/lib/libdbus-glib-1.so.2)
/opt/google/chrome/chrome http://localhost:5600: symbol lookup error: /usr/lib/libgtk-x11-2.0.so.0: undefined symbol: g_type_check_instance_is_fundamentally_a
/usr/bin/xdg-open: line 854: x-www-browser: command not found
/usr/lib/firefox/firefox: /home/johan/Downloads/activitywatch/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/firefox/firefox)
/usr/bin/xdg-open: line 854: iceweasel: command not found
/usr/bin/xdg-open: line 854: seamonkey: command not found
/usr/bin/xdg-open: line 854: mozilla: command not found
/usr/bin/xdg-open: line 854: epiphany: command not found
/usr/bin/xdg-open: line 854: konqueror: command not found
/usr/bin/xdg-open: line 854: chromium: command not found
/usr/bin/xdg-open: line 854: chromium-browser: command not found
/usr/bin/xdg-open: line 854: google-chrome: command not found
/usr/bin/xdg-open: line 854: www-browser: command not found
/usr/bin/xdg-open: line 854: links2: command not found
/usr/bin/xdg-open: line 854: elinks: command not found
/usr/bin/xdg-open: line 854: links: command not found
/usr/bin/xdg-open: line 854: lynx: command not found
/usr/bin/xdg-open: line 854: w3m: command not found
xdg-open: no method available for opening 'http://localhost:5600'
lundibundi commented 6 years ago

I'd like to also add my use case. I use Arch linux and the buttons are not working as well.

I can provide the log's if needed but it seems you are aware of the problem (https://github.com/ActivityWatch/aw-qt/issues/32).

Also, what's the current status of this issue? (as there was no activity here for a while).

Thanks for the app, I'll try to use it anyway.

johan-bjareholt commented 6 years ago

@lundibundi Yeah, the state of the PyInstaller release bundles aren't great but there are sadly no good cross-platform alternatives. For Linux I will likely make an attempt to make a flatpak package later which should solve these issues there at least. For now the recommended installation method on linux is from source which should be stable.

First of all both buttons produce fontconfig parsing error with various fields in the default config reported as errors (this is probably due to the new format of fontconfig 2.13+ as I understood after a bit of googling and it seems that AW bundles older fontconfig library which is not compatible with the new config)

Ugly hack, but could possibly be fixed by removing "libfontconfig.so.1" in the activitywatch folder.

lundibundi commented 6 years ago

@johan-bjareholt well, I've just tried that. aw-qt segfaulted right away =) As for the source install I'll try that, thanks.

EDIT: I've installed from source and it seems good for now, thx.

xylix commented 4 years ago

Is this a non-issue now that we build the bundle in ActivityWatch/activitywatch and it has working dashboard / api broswer buttons?

ErikBjare commented 4 years ago

The bundle has always been built in ActivityWatch/activitywatch. This particular issue only ever happened in some Linux environments, and I'm not exactly what those were so can't be sure if it's still an issue. But works fine for me on Arch Linux Uh, actually it doesn't.

Edit: The issue as I understand it has to do with the Python webbrowser module propagating the LD_LIBRARY_PATH environment variable it sets to the browser application/launcher, which includes stuff like an incompatible version of glibc and therefore fails to start the application.

tuxitop commented 4 years ago

This is an annoying bug which is apparently still present in arch linux. I have been able to work around this for now by using running the following command to start aw-qt.

LD_PRELOAD="/usr/lib/libstdc++.so.6 /usr/lib/libfreetype.so.6 /usr/lib/libz.so.1" aw-qt

johan-bjareholt commented 4 years ago

Someone who has this issue, could you try this out if it works? https://github.com/ActivityWatch/aw-qt/pull/59#issuecomment-649280546

johan-bjareholt commented 4 years ago

It is now merged, will be fixed in the next version of ActivityWatch or if you build yourself from master.

If it doesn't work for someone, please add a comment and I'll reopen this issue.