Skip to content

SharpWebview incompatible with Ubuntu 24.04+ (webkit2gtk-4.1) #46

@rthomasv3

Description

@rthomasv3

Problem

SharpWebview applications fail to run on Ubuntu 24.04+ because the required libwebkit2gtk-4.0 packages are no longer available. Ubuntu 24.04 only provides libwebkit2gtk-4.1 packages.

Current Behavior

  • Applications built with SharpWebview fail to start on Ubuntu 24.04+
  • No migration path available for newer Ubuntu versions

Expected Behavior

  • SharpWebview should work on current Ubuntu LTS releases (24.04+)
  • Should support both webkit2gtk-4.0 (older systems) and webkit2gtk-4.1 (newer systems)

Root Cause

The CMakeLists.txt hardcodes webkit2gtk-4.0:

pkg_check_modules(
    webkit2 REQUIRED webkit2gtk-4.0
    IMPORTED_TARGET
)

This has the additional problem of requiring the -dev packages to be installed on Linux systems for runtime operation, which is not standard practice. Runtime applications should only require runtime packages.

$ dpkg -L libwebkit2gtk-4.0-37 | grep -E '\.(so|pc)$'
/usr/lib/x86_64-linux-gnu/webkit2gtk-4.0/injected-bundle/libwebkit2gtkinjectedbundle.so
$ dpkg -L libwebkit2gtk-4.0-dev | grep -E '\.(so|pc)$'
/usr/lib/x86_64-linux-gnu/pkgconfig/webkit2gtk-4.0.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/webkit2gtk-web-extension-4.0.pc
/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so

Impact

  • Blocks adoption on any current Ubuntu LTS system (24.04+)
  • Forces unnecessary dev package dependencies on production systems

Workaround

The following workaround gets things working on Ubuntu 24.04 by adding the Ubuntu 22.04 repository to access webkit2gtk-4.0 packages. Use at your own risk - mixing packages from different Ubuntu versions can cause system instability.

  1. Add Ubuntu 22.04 repository

Add this to the bottom of /etc/apt/sources.list.d/ubuntu.sources:

Types: deb
URIs: http://gb.archive.ubuntu.com/ubuntu
Suites: jammy
Components: main
  1. Install webkit2gtk-4.0 packages
sudo apt update
sudo apt install libwebkit2gtk-4.0-dev
sudo apt --fix-broken install
  1. Optional: Remove the jammy repository after installation to prevent accidental package mixing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions