wails icon indicating copy to clipboard operation
wails copied to clipboard

Ubuntu 24.04 dependency issue (libwebkit)

Open wadert3 opened this issue 1 year ago • 12 comments

Description

When running wails dev I ran into this error:

Package webkit2gtk-4.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `webkit2gtk-4.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'webkit2gtk-4.0', required by 'virtual:world', not found
Package 'webkit2gtk-4.0', required by 'virtual:world', not found
Package 'webkit2gtk-4.0', required by 'virtual:world', not found

Wails doctor returns:

 WARNING  Your system has missing dependencies!
Fatal:
Required dependencies missing: libwebkit
Please read this article on how to resolve this: https://wails.io/guides/resolving-missing-packages

 ♥   If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony

https://wails.io/guides/resolving-missing-packages is also not a valid link

To Reproduce

  1. Run wails dev

Or

  1. Wails doctor:
  2. "Required dependencies missing"

Expected behaviour

Successful build step or found package installed

Screenshots

No response

Attempted Fixes

webkit2gtk-4.0-dev is installed and reinstalled. Wails has also been installed and reinstalled and computer restarted.

System Details

Wails Doctor          
                                

                                                                                
# Wails
Version         | v2.9.1
Package Manager | apt   

# System
┌──────────────────────────────────────────────────────────────────────────────────┐
| OS           | Ubuntu                                                            |
| Version      | 24.04                                                             |
| ID           | ubuntu                                                            |
| Go Version   | go1.22.4                                                          |
| Platform     | linux                                                             |
| Architecture | amd64                                                             |
| CPU          | AMD Ryzen 7 5825U with Radeon Graphics                            |
| GPU          | Barcelo (Advanced Micro Devices, Inc. [AMD/ATI]) - Driver: amdgpu |
| Memory       | 23GB                                                              |
└──────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌─────────────────────────────────────────────────────────────┐
| Dependency | Package Name    | Status    | Version          |
| *docker    | docker.io       | Installed | 26.1.4           |
| gcc        | build-essential | Installed | 12.10ubuntu1     |
| libgtk-3   | libgtk-3-dev    | Installed | 3.24.41-4ubuntu1 |
| libwebkit  | Unknown         | Not Found |                  |
| npm        | npm             | Installed | 10.8.1           |
| *nsis      | nsis            | Available | 3.09-4ubuntu1    |
| pkg-config | pkg-config      | Installed | 1.8.1-2build1    |
└────────────────── * - Optional Dependency ──────────────────┘

# Diagnosis
Optional package(s) installation details: 
  - nsis: sudo apt install nsis

 WARNING  Your system has missing dependencies!
Fatal:
Required dependencies missing: libwebkit
Please read this article on how to resolve this: https://wails.io/guides/resolving-missing-packages

 ♥   If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony

Additional context

No response

wadert3 avatar Jun 29 '24 20:06 wadert3

This should fix it for you: https://wails.io/docs/gettingstarted/building We should probably add a message if we can detect the OS.

leaanthony avatar Jun 30 '24 04:06 leaanthony

I have tried to add flag -tags webkit2_41 to my wails build multiple times. However, I still did not manage to build the binary. So instead of doing that over and over again. I tried this;

  1. Add the previous repo and install the needed webkit. Open your terminal and sudo nano /etc/apt/sources.list.d/ubuntu.sources

  2. Add the following lines

Types: deb
URIs: http://br.archive.ubuntu.com/ubuntu/
Suites: jammy noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb
URIs: http://security.ubuntu.com/ubuntu/
Suites: jammy-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
  1. Update the repo again by sudo apt update and install the needed dependencies sudo apt install libwebkit2gtk-4.0-dev

  2. Now, since this is a dirty hack, you need to reinstate the original PPA list. So just undo step 2, by removing the lines, and save.

# Wails
Version         | v2.9.1
Package Manager | apt   

# System
┌───────────────────────────────────────────────────────────────────┐
| OS           | Ubuntu                                             |
| Version      | 24.04                                              |
| ID           | ubuntu                                             |
| Go Version   | go1.22.2                                           |
| Platform     | linux                                              |
| Architecture | amd64                                              |
| CPU          | Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz           |
| GPU          | HD Graphics 620 (Intel Corporation) - Driver: i915 |
| Memory       | 15GB                                               |
└───────────────────────────────────────────────────────────────────┘

# Dependencies
┌──────────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name          | Status    | Version                 |
| *docker    | docker.io             | Available | 24.0.7-0ubuntu4         |
| gcc        | build-essential       | Installed | 13.2.0                  |
| libgtk-3   | libgtk-3-dev          | Installed | 3.24.41-4ubuntu1.1      |
| libwebkit  | libwebkit2gtk-4.0-dev | Installed | 2.44.2-0ubuntu0.22.04.1 |
| npm        | npm                   | Installed | 10.8.2                  |
| *nsis      | nsis                  | Available | 3.09-4ubuntu1           |
| pkg-config | pkg-config            | Installed | 1.8.1                   |
└──────────────────────── * - Optional Dependency ─────────────────────────┘

nurfaizfoat avatar Jul 25 '24 09:07 nurfaizfoat

I have tried to add flag -tags webkit2_41 to my wails build multiple times. However, I still did not manage to build the binary. So instead of doing that over and over again. I tried this;

1. Add the previous repo and install the needed webkit. Open your terminal and `sudo nano /etc/apt/sources.list.d/ubuntu.sources`

2. Add the following lines
Types: deb
URIs: http://br.archive.ubuntu.com/ubuntu/
Suites: jammy noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb
URIs: http://security.ubuntu.com/ubuntu/
Suites: jammy-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
3. Update the repo again by `sudo apt update` and install the needed dependencies `sudo apt install libwebkit2gtk-4.0-dev`

4. Now, since this is a dirty hack, you need to reinstate the original PPA list. So just undo step 2, by removing the lines, and save.
# Wails
Version         | v2.9.1
Package Manager | apt   

# System
┌───────────────────────────────────────────────────────────────────┐
| OS           | Ubuntu                                             |
| Version      | 24.04                                              |
| ID           | ubuntu                                             |
| Go Version   | go1.22.2                                           |
| Platform     | linux                                              |
| Architecture | amd64                                              |
| CPU          | Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz           |
| GPU          | HD Graphics 620 (Intel Corporation) - Driver: i915 |
| Memory       | 15GB                                               |
└───────────────────────────────────────────────────────────────────┘

# Dependencies
┌──────────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name          | Status    | Version                 |
| *docker    | docker.io             | Available | 24.0.7-0ubuntu4         |
| gcc        | build-essential       | Installed | 13.2.0                  |
| libgtk-3   | libgtk-3-dev          | Installed | 3.24.41-4ubuntu1.1      |
| libwebkit  | libwebkit2gtk-4.0-dev | Installed | 2.44.2-0ubuntu0.22.04.1 |
| npm        | npm                   | Installed | 10.8.2                  |
| *nsis      | nsis                  | Available | 3.09-4ubuntu1           |
| pkg-config | pkg-config            | Installed | 1.8.1                   |
└──────────────────────── * - Optional Dependency ─────────────────────────┘

This worked perfectly for me on Linux Mint, thank you.

ttambow avatar Sep 10 '24 07:09 ttambow

Does the solution mentioned by @leaanthony allow a single binary to use either 2.40 or 2.41? For example, users who are on the latest Ubuntu can run it with 2.41 and other Linux users can run it using 2.40 without having to distribute separate binaries for each.

ahmouse15 avatar Sep 21 '24 02:09 ahmouse15

I have tried to add flag -tags webkit2_41 to my wails build multiple times. However, I still did not manage to build the binary. So instead of doing that over and over again. I tried this;

1. Add the previous repo and install the needed webkit. Open your terminal and `sudo nano /etc/apt/sources.list.d/ubuntu.sources`

2. Add the following lines
Types: deb
URIs: http://br.archive.ubuntu.com/ubuntu/
Suites: jammy noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb
URIs: http://security.ubuntu.com/ubuntu/
Suites: jammy-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
3. Update the repo again by `sudo apt update` and install the needed dependencies `sudo apt install libwebkit2gtk-4.0-dev`

4. Now, since this is a dirty hack, you need to reinstate the original PPA list. So just undo step 2, by removing the lines, and save.
# Wails
Version         | v2.9.1
Package Manager | apt   

# System
┌───────────────────────────────────────────────────────────────────┐
| OS           | Ubuntu                                             |
| Version      | 24.04                                              |
| ID           | ubuntu                                             |
| Go Version   | go1.22.2                                           |
| Platform     | linux                                              |
| Architecture | amd64                                              |
| CPU          | Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz           |
| GPU          | HD Graphics 620 (Intel Corporation) - Driver: i915 |
| Memory       | 15GB                                               |
└───────────────────────────────────────────────────────────────────┘

# Dependencies
┌──────────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name          | Status    | Version                 |
| *docker    | docker.io             | Available | 24.0.7-0ubuntu4         |
| gcc        | build-essential       | Installed | 13.2.0                  |
| libgtk-3   | libgtk-3-dev          | Installed | 3.24.41-4ubuntu1.1      |
| libwebkit  | libwebkit2gtk-4.0-dev | Installed | 2.44.2-0ubuntu0.22.04.1 |
| npm        | npm                   | Installed | 10.8.2                  |
| *nsis      | nsis                  | Available | 3.09-4ubuntu1           |
| pkg-config | pkg-config            | Installed | 1.8.1                   |
└──────────────────────── * - Optional Dependency ─────────────────────────┘

Thank you this worked for me on linux mint!

The only thing i did different was I just used sudo nano /etc/apt/sources.list.d/official-package-repositories.list and then added the following lines:

deb http://br.archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb http://br.archive.ubuntu.com/ubuntu/ noble-updates main restricted universe multiverse
deb http://br.archive.ubuntu.com/ubuntu/ noble-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse

pontin01 avatar Sep 25 '24 00:09 pontin01

Glad it was sorted. Would you be up for creating a PR to update the docs on this? It sure would help a bunch of people.

leaanthony avatar Sep 27 '24 05:09 leaanthony

For other people running into issues running wails dev with -tags webkit2_41 who encounter the error message AcceleratedSurfaceDMABuf was unable to construct a complete framebuffer see: https://github.com/tauri-apps/tauri/issues/9304

ysmilda avatar Oct 22 '24 09:10 ysmilda

Would it be possible to drop the webkit2_41 tag and default to using libwebkit2gtk-4.1-dev or would this somehow cause additional issues?

Sammy-T avatar Nov 18 '24 08:11 Sammy-T

Not sure how many systems that will break

leaanthony avatar Nov 19 '24 08:11 leaanthony

Yes, I wouldn't want to break support for too many systems.

In my small bit of testing I'm able to run apps built with the webkit2_41 tag on Ubuntu 22.04 and Ubuntu 24.04 provided they have the necessary packages installed. But I'm not knowledgeable enough about the libwebkit2gtk package or Linux OSes to figure out if a reasonable amount of distros would still be supported by defaulting to the webkit2_41 build.

Maybe someone with more Linux experience than me knows if there's a good way to gauge Linux support.

Sammy-T avatar Nov 19 '24 21:11 Sammy-T

Yeah, ultimately this comes down to a distribution issue. We're addressing this in v3 with support for AppImage and some formats of packages.

leaanthony avatar Nov 20 '24 08:11 leaanthony

I have tried to add flag -tags webkit2_41 to my wails build multiple times. However, I still did not manage to build the binary. So instead of doing that over and over again. I tried this;

1. Add the previous repo and install the needed webkit. Open your terminal and `sudo nano /etc/apt/sources.list.d/ubuntu.sources`

2. Add the following lines
Types: deb
URIs: http://br.archive.ubuntu.com/ubuntu/
Suites: jammy noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb
URIs: http://security.ubuntu.com/ubuntu/
Suites: jammy-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
3. Update the repo again by `sudo apt update` and install the needed dependencies `sudo apt install libwebkit2gtk-4.0-dev`

4. Now, since this is a dirty hack, you need to reinstate the original PPA list. So just undo step 2, by removing the lines, and save.
# Wails
Version         | v2.9.1
Package Manager | apt   

# System
┌───────────────────────────────────────────────────────────────────┐
| OS           | Ubuntu                                             |
| Version      | 24.04                                              |
| ID           | ubuntu                                             |
| Go Version   | go1.22.2                                           |
| Platform     | linux                                              |
| Architecture | amd64                                              |
| CPU          | Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz           |
| GPU          | HD Graphics 620 (Intel Corporation) - Driver: i915 |
| Memory       | 15GB                                               |
└───────────────────────────────────────────────────────────────────┘

# Dependencies
┌──────────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name          | Status    | Version                 |
| *docker    | docker.io             | Available | 24.0.7-0ubuntu4         |
| gcc        | build-essential       | Installed | 13.2.0                  |
| libgtk-3   | libgtk-3-dev          | Installed | 3.24.41-4ubuntu1.1      |
| libwebkit  | libwebkit2gtk-4.0-dev | Installed | 2.44.2-0ubuntu0.22.04.1 |
| npm        | npm                   | Installed | 10.8.2                  |
| *nsis      | nsis                  | Available | 3.09-4ubuntu1           |
| pkg-config | pkg-config            | Installed | 1.8.1                   |
└──────────────────────── * - Optional Dependency ─────────────────────────┘

Thank you this worked for me on linux mint!

The only thing i did different was I just used sudo nano /etc/apt/sources.list.d/official-package-repositories.list and then added the following lines:

deb http://br.archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb http://br.archive.ubuntu.com/ubuntu/ noble-updates main restricted universe multiverse
deb http://br.archive.ubuntu.com/ubuntu/ noble-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse

worked for me

triadmoko avatar Apr 30 '25 04:04 triadmoko

On Fedora 41, when I run wails dev I see:

Package 'webkit2gtk-4.0' not found

I ran wails doctor and it said webkit2gtk4.0-devel was installed.

# Dependencies
┌────────────────────────────────────────────────────────┐
| Dependency | Package Name        | Status    | Version |
| *docker    | moby-engine         | Installed | 28.3.0  |
| gcc        | gcc-c++             | Installed | 14.3.1  |
| libgtk-3   | gtk3-devel          | Installed | 3.24.43 |
| libwebkit  | webkit2gtk4.0-devel | Installed | 2.46.5  |
| npm        | nodejs-npm          | Installed | 10.9.2  |
| pkg-config | pkgconf-pkg-config  | Installed | 2.3.0   |
| *upx       | upx                 | Installed | 5.0.1   |
|                                                        |
└─────────────── * - Optional Dependency ────────────────┘

However, after running sudo dnf install webkit2gtk4.0-devel the error went away and wails dev started working.

It makes me wonder: Does wails doctor have a bug where it misreports whether webkit2gtk4.0-devel is installed on Fedora 41?

Edit: I ran into the same issue on Arch Linux and brew doctor seems to work as expected on that computer:

# Dependencies
┌───────────────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version                   |
| *docker    | docker       | Available | 1:28.2.2-1                |
| gcc        | gcc          | Installed | 15.1.1+r7+gf36ec88aa85a-1 |
| libgtk-3   | gtk3         | Installed | 1:3.24.49-2               |
| libwebkit  | webkit2gtk   | Available | 2.48.3-1                  |
| npm        | npm          | Installed | 11.2.0                    |
| pkg-config | pkgconf      | Installed | 2.4.3-1                   |
|                                                                   |
└───────────────────── * - Optional Dependency ─────────────────────┘

# Diagnosis
Required package(s) installation details: 
  - libwebkit: sudo pacman -S webkit2gtk

Optional package(s) installation details: 
  - docker: sudo pacman -S docker

So it seems like a Fedora 41 + wails doctor bug. I will report as a new issue.

Edit: Raised #4457

nbolton avatar Jul 18 '25 14:07 nbolton

I have tried to add flag -tags webkit2_41 to my wails build multiple times. However, I still did not manage to build the binary. So instead of doing that over and over again. I tried this;

1. Add the previous repo and install the needed webkit. Open your terminal and `sudo nano /etc/apt/sources.list.d/ubuntu.sources`

2. Add the following lines
Types: deb
URIs: http://br.archive.ubuntu.com/ubuntu/
Suites: jammy noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb
URIs: http://security.ubuntu.com/ubuntu/
Suites: jammy-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
3. Update the repo again by `sudo apt update` and install the needed dependencies `sudo apt install libwebkit2gtk-4.0-dev`

4. Now, since this is a dirty hack, you need to reinstate the original PPA list. So just undo step 2, by removing the lines, and save.
# Wails
Version         | v2.9.1
Package Manager | apt   

# System
┌───────────────────────────────────────────────────────────────────┐
| OS           | Ubuntu                                             |
| Version      | 24.04                                              |
| ID           | ubuntu                                             |
| Go Version   | go1.22.2                                           |
| Platform     | linux                                              |
| Architecture | amd64                                              |
| CPU          | Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz           |
| GPU          | HD Graphics 620 (Intel Corporation) - Driver: i915 |
| Memory       | 15GB                                               |
└───────────────────────────────────────────────────────────────────┘

# Dependencies
┌──────────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name          | Status    | Version                 |
| *docker    | docker.io             | Available | 24.0.7-0ubuntu4         |
| gcc        | build-essential       | Installed | 13.2.0                  |
| libgtk-3   | libgtk-3-dev          | Installed | 3.24.41-4ubuntu1.1      |
| libwebkit  | libwebkit2gtk-4.0-dev | Installed | 2.44.2-0ubuntu0.22.04.1 |
| npm        | npm                   | Installed | 10.8.2                  |
| *nsis      | nsis                  | Available | 3.09-4ubuntu1           |
| pkg-config | pkg-config            | Installed | 1.8.1                   |
└──────────────────────── * - Optional Dependency ─────────────────────────┘

Thanks man. It worked for my Ubuntu 2024 LTS!

seyedali-dev avatar Jul 24 '25 16:07 seyedali-dev

Looks like this can be closed now 👍

leaanthony avatar Aug 19 '25 22:08 leaanthony