wailsapp / wails

Create beautiful applications using Go
https://wails.io
MIT License
25.59k stars 1.24k forks source link

Ubuntu 24.04 dependency issue (libwebkit) #3581

Open wadert3 opened 5 months ago

wadert3 commented 5 months ago

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

leaanthony commented 5 months ago

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

nurfaizfoat commented 4 months ago

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 ─────────────────────────┘
ttambow commented 2 months ago

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.

ahmouse15 commented 2 months ago

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.

pontin01 commented 2 months ago

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
leaanthony commented 2 months ago

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.

ysmilda commented 1 month ago

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

Sammy-T commented 2 weeks ago

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?

leaanthony commented 1 week ago

Not sure how many systems that will break

Sammy-T commented 1 week ago

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.

leaanthony commented 1 week ago

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