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 build of project doesn't run #1816

Closed
proneon267 opened this issue Mar 17, 2023 · 7 comments
Closed

Linux appimage build of project doesn't run #1816

proneon267 opened this issue Mar 17, 2023 · 7 comments
Labels
bug A crash or error in behavior.

Comments

@proneon267
Copy link
Contributor

proneon267 commented Mar 17, 2023

Describe the bug

Output of briefcase create linux and briefcase build linux are not running and give the following error:

/tmp/.mount_r5-0.078yYSC/usr/app_packages/pkg_resources/__init__.py:2804: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('zope')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
Gtk-Message: 07:14:03.606: 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: 07:14:03.665: Failed to load module "canberra-gtk-module"

(__main__.py:12710): Pango-CRITICAL **: 07:14:03.683: pango_font_description_set_size: assertion 'size >= 0' failed

** (__main__.py:12710): WARNING **: 07:14:03.693: Failed to load shared library 'libwebkit2gtk-4.0.so.37' referenced by the typelib: /usr/lib/libgstreamer-1.0.so.0: undefined symbol: g_atomic_rc_box_acquire

** (__main__.py:12710): WARNING **: 07:14:03.695: Failed to load shared library 'libjavascriptcoregtk-4.0.so.18' referenced by the typelib: /usr/lib/libjavascriptcoregtk-4.0.so.18: undefined symbol: g_uri_parse
/tmp/.mount_r5-0.078yYSC/usr/app_packages/toga_gtk/widgets/webview.py:19: Warning: cannot retrieve class for invalid (unclassed) type 'void'
  self.native = WebKit2.WebView()
Traceback (most recent call last):
  File "/tmp/.mount_r5-0.078yYSC/usr/app_packages/toga_gtk/app.py", line 105, in gtk_startup
    self.interface.startup()
  File "/tmp/.mount_r5-0.078yYSC/usr/app/r5/app.py", line 20, in startup
    web_view = toga.WebView(style=Pack(flex=1))
  File "/tmp/.mount_r5-0.078yYSC/usr/app_packages/toga/widgets/webview.py", line 54, in __init__
    self._impl = self.factory.WebView(interface=self)
  File "/tmp/.mount_r5-0.078yYSC/usr/app_packages/toga_gtk/widgets/base.py", line 13, in __init__
    self.create()
  File "/tmp/.mount_r5-0.078yYSC/usr/app_packages/toga_gtk/widgets/webview.py", line 19, in create
    self.native = WebKit2.WebView()
TypeError: could not get a reference to type class

But doing briefcase dev, the app works fine. Moreover, earlier(about a week ago) when briefcase create linux and briefcase build linux were run on the same project, the output appimages were working fine(No changes were made to the code between the last time the linux build was generated).

Steps to reproduce

  1. Go to the project directory
  2. Run briefcase create linux and briefcase build linux
  3. Go to the linux folder and run the output appimage in a terminal
  4. See error

Expected behavior

The output appimages should run without any error like previously they did.

Screenshots

No response

Environment

  • Operating System: Linux
  • Python version: 3.8.16
  • Software versions:
    • Briefcase: 0.3.12
    • Toga:0.3

Logs


Additional context

No response

@proneon267 proneon267 added the bug A crash or error in behavior. label Mar 17, 2023
@proneon267 proneon267 changed the title Linux build of project doesn't run Linux appimage build of project doesn't run Mar 17, 2023
@freakboy3742
Copy link
Member

Thanks for the report; given what you're trying to do, and the specific timeline you've mentioned we need to be very clear about what has gone on here.

On Mar 10, we released Briefcase 0.3.13. One of the major changes in this release was changing the default output format for Linux projects. On Briefcase 0.3.12 and earlier, it was AppImage; From 0.3.13 and going forward, it is native system packages (deb, rpm). This means that the output format of briefcase build linux has changed between these two releases.

Your stack trace also mentions zope and webkit, which suggests you're trying to build an embedded web GUI project. We've discovered that AppImage can't reliably package WebKit2 (which is what provides Toga's web view); it may work, depending on your platform, but it can't be relied upon.

So:

Are you still using Briefcase 0.3.12, or have you updated?

How certain are you that the old version of the app worked? The AppImage may well have worked for you - especially if you're testing on a debian-alike operating system that has webkit2 libraries installed - but if you run on a Fedora or Arch box, or you uninstall webkit2 locally, you will likely have problems.

@proneon267
Copy link
Contributor Author

proneon267 commented Mar 18, 2023

Hello
I updated briefcase to 0.3.13 and generated new appimage build and tried to run it. But, it still gives the same error.

I am on an Arch Box and the previous appimages were working. I also checked if webkit2 was uninstalled somehow, but they are installed:

extra/webkit2gtk 2.38.4-1 [installed]
    Web content engine for GTK
extra/webkit2gtk-4.1 2.38.4-1 [installed]
    Web content engine for GTK
extra/webkit2gtk-4.1-docs 2.38.4-1
    Web content engine for GTK (documentation)
extra/webkit2gtk-5.0 2.38.4-1 [installed]
    Web content engine for GTK
extra/webkit2gtk-5.0-docs 2.38.4-1
    Web content engine for GTK (documentation)
extra/webkit2gtk-docs 2.38.4-1
    Web content engine for GTK (documentation)

Running the app with briefcase dev works, but running the generated appimage doesn't work.

To ensure that the Arch Box was not somehow damaged, I tried to run the generated appimage on an ubuntu 20.04.1 box, but it gave same error. I checked if libwebkit2gtk was missing but it was installed.

If the appimages cannot reliably package webkit2 then are there any other alternatives.

@freakboy3742
Copy link
Member

freakboy3742 commented Mar 19, 2023

To clarify - I wasn't suggesting upgrading Briefcase as a potential fix - I was trying to diagnose what has changed between your two original runs.

You're reporting that you had a "working" app image "about a week ago"; and that a new run on exactly the same code is no longer working. I was trying to establish if there had been a Briefcase update between the two runs. If there had been a Briefcase update, then that would at least be something that had changed that could indicate a potential source of error.

Based on your most recent post, it sounds like there wasn't a Briefcase update. So - if Briefcase hasn't changed, and your code hasn't changed - something must have changed. It could be due to this recent change to the Linuxdeploy GTK plugin; or, it could be due to some other change on your host system.

However, as I said - this is mostly a moot point. There is literally no way at present to package a Linux binary that uses WebKit2 with AppImage, due to issues with AppImage (and linuxdeploy) itself (linuxdeploy/linuxdeploy-plugin-gtk#42). It is possible to produce appimages that superficially appear to work; however, this will only be because your AppImage has a leaky dependency on an external library. The AppImage will work if a compatible library exists on the machine running the AppImage; but as soon as you move to a "clean" system, you'll have problems.

This is the main reason that Briefcase has moved to native system packages as the default packaging format as of Briefcase 0.3.13. The one downside to that in your case is that we don't have Arch-compatible packaging at this point. You should be able to run a briefcase "system" project, but it won't produce Arch installable packages.

The placeholders for Arch packaging support are all in place - all we need is the mechanics of how to define and build a distributable Arch package (beeware/briefcase#1064). If someone can fill in the gaps of what is required (either in the form of a complete PR, or even some pointers to the files and commands that need to be executed), I'd gladly merge (or complete) that PR.

@proneon267
Copy link
Contributor Author

Thank you for helping. I know how to package for arch but not very sure about how to package briefcase projects. I will research more about how briefcase packages them and try to package a sample project for arch.
Also, have you considered utilities like alien for converting between packages? I am not sure if this is a viable option, but it is still an option.
I will post or create a PR when I am sure how can I make briefcase package for arch.

@freakboy3742
Copy link
Member

FWIW: The System package backend generates a /usr folder that is laid out the way that Briefcase expects, including a /usr/bin/myapp binary, and various /usr/lib folders to contain the app details. DEB and RPM packaging are both essentially tools for wrapping up that /usr folder, describing how to unroll that folder into your live system "/usr" folder in a reproducible (and reversible) fashion. AIUI, Arch might make things slightly more complicated because the arch package will expect to do the compilation of the stub binary itself; but that shouldn't be too hard to accomodate, and the generated project includes the makefile to build that binary.

I've never heard of alien before, but my general inclination is to avoid general purpose "conversion" tools unless the system itself recommends them as a first-class packaging tool (i.e, will Arch's own official documentation recommend using alien?)

@freakboy3742
Copy link
Member

Procedurally, I'm going to close this as a duplicate of beeware/briefcase#1029, since it's a known Briefcase packaging issue. If you're able to provide any details on Arch/pacman packaging, they should be added to beeware/briefcase#1064.

@proneon267
Copy link
Contributor Author

Thanks I'll add the details on to beeware/briefcase#1064

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.
Projects
None yet
Development

No branches or pull requests

2 participants