Core22 doesn't work with WebKit2

With gir1.2-webkit2-4.0 & libwebkit2gtk-4.0-37 already under stage-packages section in snapcraft.yaml, the created snap still produces “ValueError: Namespace WebKit2 not available”.

The app is a pre-built binary made use of pywebview & PyGObject.

Let me know if more detail is needed. Thank you!

It almost seems like your snapcraft.yaml file is malformed. Could you post that here?

Here is my snapcraft.yaml:

name: chrono # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
version: '1.3.6' # just for humans, typically '1.2+git' or '1.3.2'
summary: Process automation tool # 79 char long summary
description: |
  Chrono is a process automation tool that frees people’s time from repetitive tasks, with its 1-click record & play features.

grade: stable # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

parts:
  chrono:
    # See 'snapcraft plugins'
    plugin: dump
    source: https://cronumax-website.s3.ap-east-1.amazonaws.com/chrono.tar.xz
    stage-packages:
      - python3-gi
      - python3-gi-cairo
      - gir1.2-gtk-3.0
      - gir1.2-webkit2-4.0
      - python3-dev
      - python3-tk

apps:
  chrono:
    command: chrono

Since this is a gui app, I’d start with adding the gnome extension to your apps section ( iirc that already brings some if webkit along, you can probably drop the stage packages (but test that first indeed :wink:))

Updated snapcraft.yaml, but the issue persists.

name: chrono # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
version: '1.3.6' # just for humans, typically '1.2+git' or '1.3.2'
summary: Process automation tool # 79 char long summary
description: |
  Chrono is a process automation tool that frees people’s time from repetitive tasks, with its 1-click record & play features.

grade: stable # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

parts:
  chrono:
    # See 'snapcraft plugins'
    plugin: dump
    source: https://cronumax-website.s3.ap-east-1.amazonaws.com/chrono.tar.xz
    stage-packages:
      - python3-gi
      - python3-gi-cairo
      - gir1.2-gtk-3.0
      - gir1.2-webkit2-4.0
      - python3-dev
      - python3-tk

apps:
  chrono:
    extensions: [gnome]
    command: chrono

You actually don’t need any of those stage-packages, that’s all included with the gnome extension. I built it without those and no longer get the webkit error, but it doesn’t like running under wayland. Same happens just running the binary without the snap. Perhaps it would work under X.

1 Like

Tried:

  1. core22 + gnome
  2. core20 + gnome-3-38

Still encountered the WebKit2 error on X11 & Wayland. What am I missing? stage-packages already removed.

My desktop OS is 22.04, does it influence my build?

I can open the binary under Wayland.

This is what I get outside of the snap and with the snap built with the gnome extension.

./chrono Traceback (most recent call last): File "main.py", line 14, in <module> 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 688, in _load_unlocked File "PyInstaller/loader/pyimod02_importers.py", line 352, in exec_module File "pynput/__init__.py", line 40, in <module> 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 688, in _load_unlocked File "PyInstaller/loader/pyimod02_importers.py", line 352, in exec_module File "pynput/keyboard/__init__.py", line 52, in <module> 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 688, in _load_unlocked File "PyInstaller/loader/pyimod02_importers.py", line 352, in exec_module File "pynput/keyboard/_xorg.py", line 39, in <module> 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 688, in _load_unlocked File "PyInstaller/loader/pyimod02_importers.py", line 352, in exec_module File "pynput/_util/xorg.py", line 40, in <module> File "pynput/_util/xorg.py", line 38, in _check File "Xlib/display.py", line 89, in __init__ File "Xlib/display.py", line 71, in __init__ File "Xlib/protocol/display.py", line 166, in __init__ Xlib.error.DisplayConnectionError: Can't connect to display ":0": b'Authorization required, but no authorization protocol specified\n' [662369] Failed to execute script 'main' due to unhandled exception!

Sorry for the inconvenience, you may try xhost + to see if your issue goes away.

May I ask if there is any breakthrough on the issue of “WebKit2 not available”?

I haven’t tried this from within a snap, but I stumbled across this while having issues building lutris on 22.04 and installing gir1.2-webkit2-4.1 fixed it for me. Not sure why the -4.0 package didn’t.

I too have similar issues for Wike, staging the webkit libs lead to segmentation fault and crash while not staging it leads to “ValueError: Namespace WebKit2 not available”. error, do anybody has a solution for this, it would help me push wike to stable ?

Edit : The Error was due to absence of Webkit6 in gnome-sdk 42 that ships with core22