fix(linux): the webkit build tag was inverted

Wails v2.11 defaults to webkit2gtk-4.0 and takes 4.1 only when told —

  #cgo !webkit2_41 pkg-config: webkit2gtk-4.0
  #cgo  webkit2_41 pkg-config: webkit2gtk-4.1

— and both the script and the doc had it the other way round: they
treated 4.1 as the default and offered a -tags webkit2_40 that does not
select anything. On a Debian 13 box, which ships only 4.1, the script
therefore detected 4.1, reported it as fine, passed no tag, ran npm for
several minutes and then stopped in cgo with "Package webkit2gtk-4.0 was
not found in the pkg-config search path".

Written from the Wails source rather than from memory this time, which
is where it should have come from in the first place.

libsoup is checked alongside, since it travels with the choice: 4.0
pairs with libsoup-2.4 and 4.1 with libsoup-3.0, and a missing one fails
the same way at the same late moment.
This commit is contained in:
2026-09-11 09:52:47 +02:00
parent 13fd2367bd
commit f22058355b
2 changed files with 28 additions and 9 deletions
+12 -2
View File
@@ -73,8 +73,18 @@ go install github.com/wailsapp/wails/v2/cmd/[email protected]
wails doctor # says what is still missing
```
`libwebkit2gtk-4.0` also works; pass `-tags webkit2_40` to `wails build` if your
distribution only has the older one.
**The webkit version decides a build tag.** Wails v2.11 defaults to
webkit2gtk-**4.0**; to build against **4.1** — which is all Debian 13 ships —
it has to be told:
```bash
wails build -tags webkit2_41 # webkit 4.1 (Debian 13, Fedora, Arch)
wails build # webkit 4.0 (Debian 12 and older)
```
Without the tag on a 4.1-only machine the frontend builds, npm runs, and then
cgo stops with `Package webkit2gtk-4.0 was not found in the pkg-config search
path`. `linux-setup.sh` picks the tag for you.
## Build
+16 -7
View File
@@ -37,17 +37,26 @@ have gcc || have cc || note "a C compiler (Wails links against the system WebKit
have pkg-config || note "pkg-config"
pkg gtk+-3.0 || note "GTK 3 development headers"
# Wails 2.10+ builds against webkit2gtk-4.1; Debian 12 and older still ship 4.0,
# which works with an extra build tag. Detect which one is present rather than
# telling the operator to guess.
# Which webkit, and therefore which build tag.
#
# Wails v2.11 defaults to webkit2gtk-4.0 and takes 4.1 only when told:
# `#cgo !webkit2_41 pkg-config: webkit2gtk-4.0` against
# `#cgo webkit2_41 pkg-config: webkit2gtk-4.1`. This script had it the other
# way round and passed no tag on a Debian 13 box that has only 4.1, so the
# frontend built and then cgo stopped with "Package webkit2gtk-4.0 was not
# found in the pkg-config search path" — after several minutes of npm.
#
# libsoup travels with it: 4.0 pairs with libsoup-2.4, 4.1 with libsoup-3.0.
webkit_tags=""
if pkg webkit2gtk-4.1; then
ok "webkit2gtk-4.1"
ok "webkit2gtk-4.1 (building with -tags webkit2_41)"
webkit_tags="-tags webkit2_41"
pkg libsoup-3.0 || note "libsoup 3 development headers (webkit 4.1 links against them)"
elif pkg webkit2gtk-4.0; then
ok "webkit2gtk-4.0 (older — will build with -tags webkit2_40)"
webkit_tags="-tags webkit2_40"
ok "webkit2gtk-4.0 (the default — no tag needed)"
pkg libsoup-2.4 || note "libsoup 2.4 development headers (webkit 4.0 links against them)"
else
note "webkit2gtk development headers (4.1 preferred, 4.0 accepted)"
note "webkit2gtk development headers (4.1 or 4.0)"
fi
# Node, and its VERSION — this is the trap on an LTS base. Ubuntu 22.04 (so