The WebkitGTK Problem

Now a days, a lot of apps, mostly gnome apps, use webkitgtk, a popular fork of Webkit which is also the backbone of the Apple’s browser Safari. Now with the advent of Webkitgtk-5.0+ snapcrafters are facing an issue, cause no WebkitGtk in gnome-42-2204 content snap or jammy repos. Building WebkitGtk is also not a viable solution for 3 major reasons:

  1. Finding the dependencies are very tough.
  2. It takes at least 1 hour if not more to build, and even with my i7-11th gen and 8gb ram, I wasn’t able to build it locally.
  3. It’ll simply increase the core app size a lot, and if 2 or more app uses the same process, it’ll be simply copies of the same library, stressing the storage of the user.

So, here comes the WebkitGtk content snap.

How is it built of?

      - -DPORT=GTK
      - -DCMAKE_BUILD_TYPE=Release
      - -DUSE_AVIF=ON
      - -DUSE_GTK4=ON

These are the cmake-parameters, most probably, the same is used for the deb of webkitgtk-6.0 [I have not tested that].

How to use it?

A lot of things needs to be done manually, as this is not done from the snapcraft. So, let’s dive in. First, let’s start from top to bottom.

    bind: $SNAP/webkitgtk-platform/usr/lib/$CRAFT_ARCH_TRIPLET/webkitgtk-6.0

Webkitgtk only searches for libraries in /usr/lib/$CRAFT_ARCH_TRIPET, so, this layout is necessary. For older webkitgtks, this was handled by gnome-extension automatically.

Next, Add the webkitgtk-6-gnome-2204-sdk as a build-snap, like this

      - webkitgtk-6-gnome-2204-sdk/latest/edge

Now, the build-environment. Add all the below line, and also add others with a : if you have some extra in those fields.

  - PKG_CONFIG_PATH: /snap/webkitgtk-6-gnome-2204-sdk/current/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:$PKG_CONFIG_PATH
  - PATH: /snap/webkitgtk-6-gnome-2204-sdk/current/usr/bin:$PATH
  - XDG_DATA_DIRS: /snap/webkitgtk-6-gnome-2204-sdk/current/usr/share:$XDG_DATA_DIRS
  - LD_LIBRARY_PATH: /snap/webkitgtk-6-gnome-2204-sdk/current/usr/lib:/snap/webkitgtk-6-gnome-2204-sdk/current/usr/lib/$CRAFT_ARCH_TRIPLET:/snap/webkitgtk-6-gnome-2204-sdk/current/usr/lib/webkitgtk-6.0:/snap/webkitgtk-6-gnome-2204-sdk/current/usr/lib/$CRAFT_ARCH_TRIPLET/girepository-1.0:$LD_LIBRARY_PATH

Now, the plugs, these are the most crucial one, add these, before the apps part.

    interface: content
    target: $SNAP/webkitgtk-platform
    default-provider: webkitgtk-6-gnome-2204

Though, the preferred mount-point is webkitgtk-platform, you can use anything as you wish for now. Just don’t forget to make the changes elsewhere according.

Now the apps part. Add these lines into the apps.environment part.

      LD_LIBRARY_PATH: $SNAP/webkitgtk-platform/usr/lib/$SNAPCRAFT_ARCH_TRIPLET:$SNAP/webkitgtk-platform/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/webkitgtk-6.0:$LD_LIBRARY_PATH
      PATH:  $SNAP/webkitgtk-platform/usr/bin:$PATH
      GI_TYPELIB_PATH: $SNAP/webkitgtk-platform/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/girepository-1.0:$GI_TYPELIB_PATH

How to run this?

So, you have created your snap, voilà. Now, to run it, first run this command in your terminal.

sudo snap disconnect <your-snap-name>:webkitgtk-6-gnome-2204 webkitgtk-6-gnome-2204:webkitgtk-6-gnome-2204

Don’t worry, you can request for an autoconnect in the store.

Problems you may face

If you’re facing this:

Traceback (most recent call last):
  File "/snap/bavarder/x15/usr/bin/bavarder", line 45, in <module>
    from bavarder import main
  File "/snap/bavarder/current/usr/share/bavarder/bavarder/", line 30, in <module>
    gi.require_version('WebKit', '6.0')
  File "/snap/bavarder/x15/gnome-platform/usr/lib/python3/dist-packages/gi/", line 126, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace WebKit not available

Or this:

/snap/newsflash/8/usr/bin/com.gitlab.newsflash: error while loading shared libraries: cannot open shared object file: No such file or directory

Then, you have surely forgotten to connect the content snap with your snap. Do that, and it’ll fix.

Or this:

** (process:172251): ERROR **: 23:34:35.683: Unable to spawn a new child process: Failed to spawn child process “/usr/lib/webkitgtk-6.0/WebKitNetworkProcess” (No such file or directory)
Trace/breakpoint trap (core dumped)

Then run once:

sudo /usr/lib/snapd/snap-discard-ns <your-snap-name>

This is only for developers, as users installing the snap from the store will never face this. You may face, if you install the snap locally.


  1. As the name suggests, this is curated specifically for gnome apps, keeping the gnome-42-2204 and gnome-42-2204-sdk in mind. So, add any missing library within your app, if you’re snapping KDE, Flutter, Gnome3 or any extension independent app.
  2. Currently, every time you create a snap, you’ll need to add all those lines extra manually to your code. So, if you forget that, you may lose time, just searching where is the error!
  3. Every time you publish a snap using this, you’ll need to make autoconnect requests. So, that the users don’t need to manually connect it.

Future Scopes

  1. This content snap can be converted into an extension. As the extensions, have the capability of passing 2 or more options. So, the environment, layouts all can be done automatically, by adding this within the snapcraft itself.
  2. The content snaps, like KDE and Gnome, can be aligned together and the webkitgtk libraries can be kept as a completely separate entity. Thus, users, will have smaller sdks, smaller apps, and all the apps using the same library.


This same thing, I’m trying to do with ffmpeg and gstreamer. Which can eventually make the possibility of a snapper missing any wierd gstreamer lib or ffmpeg lib to ‘0’. This will also reduce the burden on content snaps and also, reduce the storage burden on the user. Those can again be converted into extensions, for ease of access.


  1. Why not adding this to existing gnome-sdk?

=> The content snaps are already very large to maintain. Also, adding this and maintain within a content snap is a tough job. This will also limit this to gnome apps only. Also, I guess this is a bug or something, but I was never able to build gnome-42-2204-sdk with webkitgtk-6. As snapcraft was unable to download all the build-packages at once.

  1. How will this be updated?

=> Currently, my plan is to create a snap for each version. As some apps may use the older version of webkitgtk and may be an older core also. So, it’ll easy for them to use it.

To end this, this documentation may have error as I am only a small human. So, I’d be happy for a correction. And to all the snapcrafters, create snaps, may be for epiphany may be for tangram or ferdium or whatever app you want that uses webkitgtk-6.0+.

EDIT: The manifest link

1 Like