Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux AppImage not starting on Manjaro #919

Closed
annetracy opened this issue Oct 12, 2022 · 35 comments
Closed

Linux AppImage not starting on Manjaro #919

annetracy opened this issue Oct 12, 2022 · 35 comments
Labels
bug A crash or error in behavior. linux The issue relates Linux support.

Comments

@annetracy
Copy link

annetracy commented Oct 12, 2022

My rotate_video app runs successfully in dev mode (briefcase dev),
it builds successfully (briefcase build), but fails to run (briefcase run)

I get the following message(s) I'm not even sure this is a Toga issue.

> [rotate_video] Built linux/Rotate_Video-0.0.1-x86_64.AppImage
(rotate_video-venv) tracy@daphne:~/Projects/RotateVideos/rotate_video$ briefcase run

[rotate_video] Starting app...

** (process:72473): WARNING **: 19:04:21.337: Failed to load shared library 'libpango-1.0.so.0' referenced by the typelib: /usr/lib/libpango-1.0.so.0: undefined symbol: g_memdup2
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/.mount_RotatecyrrfT/usr/lib/python3.10/runpy.py", line 224, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/tmp/.mount_RotatecyrrfT/usr/lib/python3.10/runpy.py", line 96, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/tmp/.mount_RotatecyrrfT/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/tmp/.mount_RotatecyrrfT/usr/app/rotate_video/__main__.py", line 4, in <module>
    main().main_loop()
  File "/tmp/.mount_RotatecyrrfT/usr/app/rotate_video/app.py", line 386, in main
    return Rotate_Video()
  File "/tmp/.mount_RotatecyrrfT/usr/app_packages/toga/app.py", line 278, in __init__
    self.factory = get_platform_factory(factory)
  File "/tmp/.mount_RotatecyrrfT/usr/app_packages/toga/platform.py", line 41, in get_platform_factory
    from toga_gtk import factory
  File "/tmp/.mount_RotatecyrrfT/usr/app_packages/toga_gtk/factory.py", line 1, in <module>
    from .app import App, DocumentApp, MainWindow
  File "/tmp/.mount_RotatecyrrfT/usr/app_packages/toga_gtk/app.py", line 13, in <module>
    from .keys import gtk_accel
  File "/tmp/.mount_RotatecyrrfT/usr/app_packages/toga_gtk/keys.py", line 3, in <module>
    from .libs import Gdk
  File "/tmp/.mount_RotatecyrrfT/usr/app_packages/toga_gtk/libs/__init__.py", line 1, in <module>
    from .gtk import *  # noqa: F401, F403
  File "/tmp/.mount_RotatecyrrfT/usr/app_packages/toga_gtk/libs/gtk.py", line 5, in <module>
    from gi.repository import Gtk, Gdk, GdkPixbuf, Gio, GLib, GObject  # noqa: F401, E402
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 672, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 632, in _load_backward_compatible
  File "/tmp/.mount_RotatecyrrfT/usr/app_packages/gi/importer.py", line 149, in load_module
    importlib.import_module('gi.repository.' + dep.split("-")[0])
  File "/tmp/.mount_RotatecyrrfT/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 672, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 632, in _load_backward_compatible
  File "/tmp/.mount_RotatecyrrfT/usr/app_packages/gi/importer.py", line 149, in load_module
    importlib.import_module('gi.repository.' + dep.split("-")[0])
  File "/tmp/.mount_RotatecyrrfT/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 672, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 632, in _load_backward_compatible
  File "/tmp/.mount_RotatecyrrfT/usr/app_packages/gi/importer.py", line 150, in load_module
    dynamic_module = load_overrides(introspection_module)
  File "/tmp/.mount_RotatecyrrfT/usr/app_packages/gi/overrides/__init__.py", line 118, in load_overrides
    override_mod = importlib.import_module(override_package_name)
  File "/tmp/.mount_RotatecyrrfT/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/tmp/.mount_RotatecyrrfT/usr/app_packages/gi/overrides/Pango.py", line 41, in <module>
    FontDescription = override(FontDescription)
  File "/tmp/.mount_RotatecyrrfT/usr/app_packages/gi/overrides/__init__.py", line 195, in override
    assert g_type != TYPE_NONE
AssertionError

Operating System: Manjaro Linux
KDE Plasma Version: 5.25.5
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.6
Kernel Version: 5.15.72-1-MANJARO (64-bit)
Graphics Platform: X11

GTK2 V2.24.33
GTK3 V3.24.34

@freakboy3742
Copy link
Member

If it works in briefcase dev, but not in briefcase run, it's almost certainly a briefcase related issue rather than a Toga issue.

In this case, the error is one I've seen before. Two things to check:

  • Have you enabled the gtk linuxdeploy plugin? There should be a section in your pyproject.toml that reads:
linuxdeploy_plugins = [
    'DEPLOY_GTK_VERSION=3 gtk',
]
  • Are you using Docker for the build? If you're not, you can get some unpredictable behavior at runtime.

If those two things are both covered, could I get you to delete the "linux" folder that was generated by Briefcase, and then run briefcase run --log, and send us the resulting log file.

@annetracy
Copy link
Author

This

linuxdeploy_plugins = [ 'DEPLOY_GTK_VERSION=3 gtk', ]
was missing from the toml file.

I added those 3 lines, ran briefcase creat, briefcase build, and briefcase run, and the app ran successfully, but with the following errors.

`video$ briefcase run

[rotate_video] Starting app...
Gtk-Message: 22:08:41.882: Failed to load module "xapp-gtk3-module"
Gtk-Message: 22:08:41.904: Failed to load module "canberra-gtk-module"
/usr/lib/gvfs/libgvfscommon.so: undefined symbol: g_task_set_name
Failed to load module: /usr/lib/gio/modules/libgvfsdbus.so
Gtk-Message: 22:08:42.703: Failed to load module "window-decorations-gtk-module"
Gtk-Message: 22:08:42.719: Failed to load module "colorreload-gtk-module"
/usr/lib/gvfs/libgvfscommon.so: undefined symbol: g_task_set_name
Failed to load module: /usr/lib/gio/modules/libgioremote-volume-monitor.so
/usr/lib/gvfs/libgvfscommon.so: undefined symbol: g_task_set_name
Failed to load module: /usr/lib/gio/modules/libgvfsdbus.so
/usr/lib/gvfs/libgvfscommon.so: undefined symbol: g_task_set_name
Failed to load module: /usr/lib/gio/modules/libgioremote-volume-monitor.so

`

As a consequence the system Appearance Settings were ignored.

@freakboy3742
Copy link
Member

That's troubling... are you able to provide the full log as I described in my previous post?

@annetracy
Copy link
Author

I'll get onto that as soon as I recover from building our raised Gardens.

@annetracy
Copy link
Author

annetracy commented Oct 13, 2022 via email

@annetracy
Copy link
Author

Log emailed to return address.

@freakboy3742
Copy link
Member

The log has been stripped by a virus checker,. You can upload it directly by dragging it into a comment window on Github.

@annetracy
Copy link
Author

annetracy commented Oct 13, 2022

How do I get the file to you?

When I copy paste it's content it's too long.

When I attempt to upload it, I get 'Something went really wrong, and we can't process that file. Try again'

When I email it to you, I I get the above 'Warning: This message has had one or more attachments removed'

@freakboy3742
Copy link
Member

Like I said in my last comment - drag it into the comment box in Github. It will be uploaded as an attachment to your comment.

@annetracy
Copy link
Author

The file name ends with .run.log, the virus checker appears to believe this is an attempt to hide the real file extension. I've changed the name to end in _run.log, and will retry emailing it.

@annetracy
Copy link
Author

annetracy commented Oct 13, 2022 via email

@freakboy3742
Copy link
Member

Your email client is thing being "smart" here. Don't use it. Drag and drop the file from your file manager into the text box that you use to add a comment to this thread, and you'll get something that looks like this:
briefcase.2022_10_13-14_09_45.update.log

@annetracy
Copy link
Author

Unless you received the file as an attachment in an email, I'm still getting the message..

'Something went really wrong, and we can't process that file. Try again'

When I attenpt to upload it via this comment system.

@annetracy
Copy link
Author

Dragging and dropping the file, clicking on the bottom section of the editor and navigating to the file, makes no difference, I get the message..

'Something went really wrong, and we can't process that file. Try again'

@freakboy3742
Copy link
Member

Sounds like your browser might be "helping" with some virus checking of its own.

My next suggestion would be to zip the log file, and upload the zipped version. That's sometimes enough to convince virus checkers they don't need to panic.

@annetracy
Copy link
Author

Same error message, with Zipped File... and with pdf. The file is quite large, would that be a problem?

@freakboy3742
Copy link
Member

Depends on what you mean by "Quite large". PDF won't make the document much smaller, but zipping it should - it's text content. How big is the raw and zip versions?

@annetracy
Copy link
Author

the zip is only 20K, (the raw 383K), so I think size isn't the problem.

Try this https://www.mediafire.com/file/he5o4xvhdjij2f0/briefcase.2022_10_13-15_17_39_run.zip/file

@obulat
Copy link
Contributor

obulat commented Oct 13, 2022

@freakboy3742 freakboy3742 changed the title Unable to start app Linux AppImage not starting on Manjaro Oct 14, 2022
@freakboy3742
Copy link
Member

Based on that log, I can confirm it's a Briefcase issue, not a Toga issue; I'll transfer the issue on that basis.

The underlying problem is that Linux AppImages can be... a bit flaky. They're trying to do something that is very difficult - automatically identify all the binaries that an application uses, and relocate them so that the binary is redistributable. However,

  1. They have to assume that certain pieces will be there, and that those pieces are consistent and binary compatible between operating systems - which... has a habit of not being true.
  2. We're packaging Python, which means that a lot of the dependencies aren't known until runtime, which makes AppImage's task a lot harder.

I can't spot anything obviously wrong with the log - other than the fact that it's clearly not working.

If you hunt around for the key phrases in the errors you're seeing ("libpango-1.0.so.0", "g_memdup2", "g_task_set_name"), you'll find a common them with Manjaro AppImage having the same problem. This suggests there's a problem with either linuxdeploy or the GTK plugin.

@freakboy3742 freakboy3742 transferred this issue from beeware/toga Oct 14, 2022
@freakboy3742 freakboy3742 added bug A crash or error in behavior. up-for-grabs linux The issue relates Linux support. labels Oct 14, 2022
@annetracy
Copy link
Author

Yes I noticed those.

There may be a possibility that as GTK is installed to support GNOME apps on my KDE DE, my be causing a problem. The GNOME apps are not native to a KDE DE.

What about debs and flatpak, I noticed they were either under development of projected?

@freakboy3742
Copy link
Member

Flatpak has been implemented; briefcase X linux flatpak (for any command X) will generate a flatpak. Flatpaks tend to be harder to build if you have third-party binary library dependencies; but are more reliable when you have pure-python binaries - or binaries that fit inside the umbrella that is supported out-of-the-box by Flatpak. Unfortunately, it's difficult to quantify what that umbrella covers, other than "normal GTK desktop stuff", as the contents of the flatpak base image is somewhat opaque.

We haven't got support for debs at this time.

@annetracy
Copy link
Author

Is there any reason you chose to ignore KDE, or rather the Qt toolkit. Personally I think QT is much easier to work with. I've certainly found building QtPython apps much easier to write than GTK Python apps, and what the KDE devs have achieved leaves GNOME in the dust IMO.

Although Toga does make wotking with GTK a doddle.

I've installed a GNOME desktop (Ubuntu) on a VM, so GTK native, and am building the app on that, to see if there is any difference.

@freakboy3742
Copy link
Member

We haven't "ignored" Qt and KDE. We've made a choice to focus our limited resources.

Briefcase does provide support for Qt - it provides both PySide2 and Pyside6 templates for apps.

When it comes to Toga, we've focused our development effort on the GUI framework on GTK, as it is the GUI toolkit that drives the default desktop option on most of the popular Linux distributions (Ubuntu, Debian, Fedora, CentOS, and Raspbian, amongst others).

However, if you poke around the Toga repository, you'll find beeware/toga#1142, where we've confirmed that we'd be happy to provide native Qt support - we just need someone to contribute it. There is already a stub project in the Toga nursery. All that is missing is an implementation.

If this is an area where you're interested in contributing, then I'd encourage you to start there.

@annetracy
Copy link
Author

annetracy commented Oct 16, 2022

I was just wondering, thanks.

OK here's the thing.

I've been able to get libcanberra to install, and it loads, by adding a reference to it in the pyproject.toml file

[tool.briefcase.app.rotate_video.linux]
requires = [
    'toga-gtk>=0.3.0.dev34',
]
system_requires = [
    'libgirepository1.0-dev',
    'libcairo2-dev',
    'libpango1.0-dev',
    'libwebkitgtk-3.0-0',
    'gir1.2-webkit-3.0',
    'gir1.2-xapp-*',
    'libxapp-*',
    'libcanberra-gtk*',
]

I added the following lines...

    'gir1.2-xapp-*',
    'libxapp-*',
    'libcanberra-gtk*',

However, while it appears that all three libraries are installed, I still get the error.

Gtk-Message: 09:54:30.220: Failed to load module "xapp-gtk3-module"
/usr/lib/gvfs/libgvfscommon.so: undefined symbol: g_task_set_name
Failed to load module: /usr/lib/gio/modules/libgvfsdbus.so
Gtk-Message: 09:54:30.526: Failed to load module "window-decorations-gtk-module"
Gtk-Message: 09:54:30.580: Failed to load module "colorreload-gtk-module"

As far as i can tell the issue revolves around libxapp.

I will hopefully narrow this down.

I will also try to upload the log file.

@annetracy
Copy link
Author

@annetracy
Copy link
Author

Sorry I haven't been in for a while. I've been trying to locate a second hand laptop that I could afford... I'm a pensioner and all that.

So I installed Ubuntu 20.04 on the second Laptop, the app builds, and runs correctly on the GNOME desktop. But if the theme is changed, the app has to be restarted to reflect the changed desktop theme.

The app also runs correctly on Manjaro KDE, but fails to follow the desktop theme.

@annetracy
Copy link
Author

Ok. I've built the app on my Manjaro KDE system, transfered the resulting appimage to the Ubuntu system, the app runs correctly, and follows the desktop theme.

If I run the app from a terminal on my Manjaro KDE system, it ignores the desktop Theme, and I get the errors, I had assumed were related to the build

Gtk-Message: 06:53:04.789: Failed to load module "xapp-gtk3-module" Gtk-Message: 06:53:04.793: Failed to load module "canberra-gtk-module" /usr/lib/gvfs/libgvfscommon.so: undefined symbol: g_task_set_name Failed to load module: /usr/lib/gio/modules/libgvfsdbus.so Gtk-Message: 06:53:05.609: Failed to load module "window-decorations-gtk-module" Gtk-Message: 06:53:05.617: Failed to load module "colorreload-gtk-module"

This I now believe is related to running a GTK app on KDE, or possibly, specifically to Manjaro KDE.

Recently a poster on the Manjaro Forum posted a similar set of errors, related to running a Flatpak on a Manjaro KDE system

I will install KUbuntu on the spare laptop, to confirm if this is GTK/KDE related or specificaly Manjaro KDE

@freakboy3742
Copy link
Member

It would also be helpful to confirm if the "ignoring desktop theme" problem is a bug or a "feature". I completely agree that it isn't what most users would expect - but based on what I know of how AppImage works, I can't see how it would be possible for an AppImage to reliably adopt the end-user's theme.

AppImage works by bundling every binary needed to run an app, outside of a very small core set of libraries (essentially libc and not much else). The distributed app is very using a copy of any GUI libraries, on the basis that there's no way to guarantee that the end-user's computer will have the GUI framework that you require.

If my understanding is correct, I don't see how it would be possible for an app to use a bundled version of GTK, but not use a bundled version of the GTK theme - if only because there's no way to guarantee the end-user's theme (assuming they have one) will be compatible with the bundled version of GTK.

So - it would be helpful for you to confirm if this "theme ignoring" behavior is common to all AppImage apps. There's a collection of AppImage apps on this website - do those apps follow the system theme, or do you see the same problem?

@annetracy
Copy link
Author

I'll check that out.

@annetracy
Copy link
Author

Interesting...

I just changed the GTK3 theme setting from Breeze to Adwaita-Dark... the KDE theme is Breath-Dark.

The default Theme for Manjaro KDE is Breath, while the default Theme for GTK3 is Breeze.

Now, on the Kubuntu system the default setting for KDE is Breeze, as is the default setting for GTK3

this means the GTK3 appimage is theming correctly, in spite of those errors.

changing Kubuntu Theme to Breeze Dark for both KDE and GTK3 results in a correctly themed appimage.

So, now I can theme both KDE and GTK3 apps to more or less the same theme on Manjaro KDE... KDE theme Breath-Dark, and GTK3 Adwaita-Dark, and the appimage picks up the GTK3 theme.

and on the Kubuntu system I can set KDE to Breeze-Dark and GTK3 to Breeze-Dark, and the appimage correctly picks up the GTK3 theme.

Sorry this appears to have been a bit of a wild Goose chase. The biggest problem seems to be there is no comparable Breath Theme for GTK apps on Manjaro KDE, whereas the older Breeze Theme is available on Kubuntu.

@freakboy3742
Copy link
Member

No worries about the goose chase - app packaging issues are 99% goose by volume :-)

To clarify where we are at, if I'm following correctly:

  1. The originally reported problem (the app not starting at all) has been resolved, as long as 'gir1.2-xapp-*', 'libxapp-*', 'libcanberra-gtk*' is added to the system requires when the app is built.
  2. The theming issue is largely down to whether the system where the app is running has thethemes available/installed

If that's the case, it sounds like there's not much we can do with 92); but for (1) we can add the extra required system libraries to the base briefcase-template so that every new project gets those installed by default. It would be preferable if we can narrow those packages down to specific versions, rather than wildcards; from a quick inspection of the packages installed by the wildcards, there's a lot of extra stuff being installed, not just 3 extra packages, and it's not immediately obvious to me why some of them are needed. If they are, that's fine - but I'd rather be explicit about those requirements.

@annetracy
Copy link
Author

No I think one was solved by adding

'DEPLOY_GTK_VERSION=3 gtk',

Which was missing. Ensuring that that is indeed in the .toml means the app will build and run.

The errors related to 'gir1.2-xapp-*', 'libxapp-*', 'libcanberra-gtk*' don't appear to affect functionality, and when issue (2) is accounted for, by selecting a GTK3 theme that is comparable to the current non GTK/GNOME DE theme, those errors seem irrelevant.

I've just installed snap that is built on GTK3, and it exhibits the same 'issues', and runs correctly, and with my GTK3 Theme choice fits my KDE theme.

But yes (2) is basically DE and Theme dependant

A lot of my running around in circles was related to my lack of understanding of how Appimage/Flatpak/Snaps work.

@freakboy3742
Copy link
Member

Ok - in which case, can we close this issue as resolved? AFAICT, DEPLOY_GTK_VERSION=3 gtk will be included, as long as you're using a recent version of Briefcase; it won't be added automatically to an existing project, but there isn't much we can do about that.

@annetracy
Copy link
Author

yes please close.

I'll do some research, and probably look at the QT stub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior. linux The issue relates Linux support.
Projects
None yet
Development

No branches or pull requests

2 participants