webview / webview_go

Go language bindings for the webview library.
MIT License
176 stars 27 forks source link

error running on ubuntu 24.04 #44

Open benitogf opened 2 months ago

benitogf commented 2 months ago

I tried running on ubuntu 24.04 and the binary fails to find the libraries

error while loading shared libraries: libwebkit2gtk-4.0.so.37: cannot open shared object file: No such file or directory

think 24.04 uses a different version

root@idx-benito-machine /h/idx# apt install libgtk-3-bin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libgtk-3-bin is already the newest version (3.24.41-4ubuntu1).
libgtk-3-bin set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@idx-benito-machine /h/idx# apt install libwebkit2gtk-4.1-0
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libwebkit2gtk-4.1-0 is already the newest version (2.44.0-2).
libwebkit2gtk-4.1-0 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
SteffenL commented 2 months ago

I had a quick peek and as you say, the packages for libwebkit2gtk-4.0 are unavailable for Ubuntu 24.04. Also, packages for libwebkit2gtk-4.1 are unavailable for Ubuntu 20.04.

If we change this line in webview.go:

-#cgo linux openbsd freebsd netbsd pkg-config: gtk+-3.0 webkit2gtk-4.0
+#cgo linux openbsd freebsd netbsd pkg-config: gtk+-3.0 webkit2gtk-4.1

Then the Go package can't work on Ubuntu 20.04.

So it seems like we need to do this:

-#cgo linux openbsd freebsd netbsd pkg-config: gtk+-3.0 webkit2gtk-4.0
+#cgo linux openbsd freebsd netbsd pkg-config: gtk+-3.0

Or remove the whole line.

But that would break the normal Go workflow.

We would need to inform users on how to make this work by setting variables for "cgo" (CGO_CFLAGS, CGO_CXXFLAGS, CGO_LDFLAGS, CGO_ENABLED), or I imagine we would need to dynamically choose which webkit2gtk library to use.

If there's another, better way then I would love to learn more about it. Otherwise, I'm not sure how to make this work seamlessly for Go.

Maybe it isn't possible to make it seamless but I would love to be proven wrong.

Ideas as more than welcome.

danielsatanik commented 2 months ago

I don't have an issue setting env vars, how would that work?

benitogf commented 2 months ago

20.04 eol is april 2025, maybe we can make a branch with this change to support 24.04 until then?

nimeshnsat commented 1 month ago

webkit2gtk-4.1 is available for 20.04 LTS is as well. One option is to specify webkit2gtk-4.1 as a dependency through the installer of the application (example: https://www.debian.org/doc/debian-policy/ch-relationships.html )

SteffenL commented 1 month ago

@nimeshnsat Can you please explain how you determined that webkit2gtk-4.1 is available for Ubuntu 20.04?

nimeshnsat commented 1 month ago

My bad 😢 . Apperently, I've upgraded my 20.04 LTS to 22.04 LTS sometime back. So technically I'm on 22.04.1 now.

Today I've created a VM with 20.04 and tested from the scratch. I can confirm it doesn't support 4.1

Trace from my 22.04 (seems like it is available under security updates)

# uname -a

Linux ubuntu-20 6.5.0-28-generic #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr  4 14:39:20 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

# sudo apt search libwebkit2gtk-4.1

Sorting... Done

Full Text Search... Done

libwebkit2gtk-4.1-0/jammy-updates,jammy-security,now 2.44.0-0ubuntu0.22.04.1 amd64 [installed]

  Web content engine library for GTK

libwebkit2gtk-4.1-dev/jammy-updates,jammy-security,now 2.44.0-0ubuntu0.22.04.1 amd64 [installed]

  Web content engine library for GTK - development files
SteffenL commented 1 month ago

All right, thanks!