wails icon indicating copy to clipboard operation
wails copied to clipboard

wails 2.9.0 linux issue

Open LoryPelli opened this issue 1 year ago • 11 comments

Description

I can't start dev and I can't build

To Reproduce

try starting dev or building on linux latest version of wails

Expected behaviour

it shouldn't give error

Screenshots

image

Attempted Fixes

No response

System Details

Wails Doctor



# Wails
Version         | v2.9.0
Package Manager | pacman

# System
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| OS           | EndeavourOS                                                                                          |
| Version      | Unknown                                                                                              |
| ID           | endeavouros                                                                                          |
| Go Version   | go1.22.4                                                                                             |
| Platform     | linux                                                                                                |
| Architecture | amd64                                                                                                |
| CPU          | Intel(R) Core(TM) i3-4005U CPU @ 1.70GHz                                                             |
| GPU 1        | GF117M [GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M] (NVIDIA Corporation) - Driver: nouveau |
| GPU 2        | Haswell-ULT Integrated Graphics Controller (Intel Corporation) - Driver: i915                        |
| Memory       | 4GB                                                                                                  |
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌───────────────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version                   |
| *docker    | docker       | Available | 1:26.1.4-1                |
| gcc        | gcc          | Installed | 14.1.1+r58+gfc9fb69ad62-1 |
| libgtk-3   | gtk3         | Installed | 1:3.24.42-1               |
| libwebkit  | webkit2gtk   | Installed | 2.44.2-1                  |
| npm        | npm          | Available | 10.8.1-1                  |
| pkg-config | pkgconf      | Installed | 2.1.1-1                   |
└───────────────────── * - Optional Dependency ─────────────────────┘

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

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

 WARNING  Your system has missing dependencies!

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

Additional context

I'm using pnpm to install packages and that's why I don't have npm

LoryPelli avatar Jun 16 '24 08:06 LoryPelli

Came here to file this same issue. My outsider analysis is that this is a new bug with the drag and drop functionality released in v2.9.0, specifically in PR #3203 (and later included in #3516).

The specific error is coming from line 510: https://github.com/wailsapp/wails/blob/d96d3b001069b0e28be93c20dc6424a3b64d90a1/v2/internal/frontend/desktop/linux/window.c#L508-L511

I'm not sure what the correct fix is as I'm not familiar with GTK programming.

Enabling drag and drop in app settings does not fix this, because as C is a compiled language, the compiler is going to die on this anyways.

makew0rld avatar Jun 16 '24 23:06 makew0rld

I'm curious how @lyimmi and @jakubpeleska were able to test this on Ubuntu, since it seems the function signature of gtk_drag_dest_unset has stayed the same for years (since that would be a breaking change of course). From my perspective I couldn't see how this would build at all on Linux, but of course that must mean there's some more complex interaction going on... maybe a change in glib, which is also mentioned in the compile error?

makew0rld avatar Jun 16 '24 23:06 makew0rld

For completeness, here is my error log and doctor output:

  • Compiling application: # github.com/wailsapp/wails/v2/internal/frontend/desktop/linux
In file included from /usr/include/glib-2.0/gobject/gobject.h:26,
                 from /usr/include/glib-2.0/gobject/gbinding.h:31,
                 from /usr/include/glib-2.0/glib-object.h:24,
                 from /usr/include/glib-2.0/gio/gioenums.h:30,
                 from /usr/include/glib-2.0/gio/giotypes.h:30,
                 from /usr/include/glib-2.0/gio/gio.h:28,
                 from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:28,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,
                 from window.c:2:
window.c: In function ‘SetupWebview’:
/usr/include/glib-2.0/gobject/gtype.h:2656:42: error: passing argument 1 of ‘gtk_drag_dest_unset’ from incompatible pointer type [-Wincompatible-pointer-types]
 2656 | #  define _G_TYPE_CIC(ip, gt, ct)       ((ct*) (void *) ip)
/usr/include/glib-2.0/gobject/gtype.h:528:66: note: in expansion of macro ‘_G_TYPE_CIC’
  528 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type)    (_G_TYPE_CIC ((instance), (g_type), c_type))
      |                                                                  ^~~~~~~~~~~
/usr/include/glib-2.0/gobject/gobject.h:54:38: note: in expansion of macro ‘G_TYPE_CHECK_INSTANCE_CAST’
   54 | #define G_OBJECT(object)            (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_OBJECT, GObject))
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
window.c:510:29: note: in expansion of macro ‘G_OBJECT’
  510 |         gtk_drag_dest_unset(G_OBJECT(webview));
      |                             ^~~~~~~~
In file included from /usr/include/gtk-3.0/gtk/gtk.h:87:
/usr/include/gtk-3.0/gtk/gtkdragdest.h:83:47: note: expected ‘GtkWidget *’ {aka ‘struct _GtkWidget *’} but argument is of type ‘GObject *’ {aka ‘struct _GObject *’}
   83 | void gtk_drag_dest_unset (GtkWidget          *widget);
      |                           ~~~~~~~~~~~~~~~~~~~~^~~~~~
# Wails
Version         | v2.9.0
Package Manager | pacman

# System
┌───────────────────────────────────────────────────────────────────────────────────────┐
| OS           | Arch Linux                                                             |
| Version      | Unknown                                                                |
| ID           | arch                                                                   |
| Go Version   | go1.22.3                                                               |
| Platform     | linux                                                                  |
| Architecture | amd64                                                                  |
| CPU          | 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz                         |
| GPU          | TigerLake-LP GT2 [Iris Xe Graphics] (Intel Corporation) - Driver: i915 |
| Memory       | 15GB                                                                   |
└───────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌───────────────────────────────────────────────────────────────────┐
| Dependency | Package Name | Status    | Version                   |
| *docker    | docker       | Installed | 1:26.1.3-1                |
| gcc        | gcc          | Installed | 14.1.1+r58+gfc9fb69ad62-1 |
| libgtk-3   | gtk3         | Installed | 1:3.24.42-1               |
| libwebkit  | webkit2gtk   | Installed | 2.44.2-1                  |
| npm        | npm          | Installed | 10.8.0-1                  |
| pkg-config | pkgconf      | Installed | 2.1.1-1                   |
└───────────────────── * - Optional Dependency ─────────────────────┘

# Diagnosis
 SUCCESS  Your system is ready for Wails development!

makew0rld avatar Jun 16 '24 23:06 makew0rld

Okay, I was able to compile successfully with just a small edit! (off of v2.9.0 aka d96d3b001069b0e28be93c20dc6424a3b64d90a1)

diff --git a/v2/internal/frontend/desktop/linux/window.c b/v2/internal/frontend/desktop/linux/window.c
index 49de5197..cf06f638 100644
--- a/v2/internal/frontend/desktop/linux/window.c
+++ b/v2/internal/frontend/desktop/linux/window.c
@@ -507,7 +507,7 @@ GtkWidget *SetupWebview(void *contentManager, GtkWindow *window, int hideWindowO
 
     if(disableWebViewDragAndDrop)
     {
-        gtk_drag_dest_unset(G_OBJECT(webview));
+        gtk_drag_dest_unset(webview);
     }
 
     if(enableDragAndDrop)
@@ -827,4 +827,4 @@ void InstallF12Hotkey(void *window)
     gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
     GClosure *closure = g_cclosure_new(G_CALLBACK(sendShowInspectorMessage), window, NULL);
     gtk_accel_group_connect(accel_group, GDK_KEY_F12, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE, closure);
-}
\ No newline at end of file
+}

This is what I suspected would be needed originally. This makes me very curious how things were able to compile for others before.

makew0rld avatar Jun 17 '24 00:06 makew0rld

Hi, Interesting on Ubuntu 22.04 both version is working. With and without the type conversion. I think this is a difference in glib.

We should test it on the latest ubuntu too and if it is working without the conversion we could simply remove it.

lyimmi avatar Jun 17 '24 06:06 lyimmi

I ran the build github action manually with concurrent builds for 22.04 and 24.04 using the change in the linked PR and it appears to work: https://github.com/wailsapp/wails/actions/runs/9546659779

leaanthony avatar Jun 17 '24 11:06 leaanthony

Would appreciate it if you could test master. It should be fixed.

leaanthony avatar Jun 17 '24 12:06 leaanthony

Using the latest master (b40fd93edb1c9a74904992ec9a98b0ed3462c052) in my go.mod allows my to compile on Arch Linux successfully. Thanks!

Is there a chance this could be in a release soon, since v2.9.0 can't be used on Linux?

makew0rld avatar Jun 17 '24 14:06 makew0rld

I ran the build github action manually with concurrent builds for 22.04 and 24.04 using the change in the linked PR and it appears to work: https://github.com/wailsapp/wails/actions/runs/9546659779

@leaanthony @makew0rld I have checked on another machine with 24.04 and I can confirm the current master branch is working for me too.

lyimmi avatar Jun 17 '24 17:06 lyimmi

@lorypelli does the master branch work for you?

leaanthony avatar Jun 17 '24 19:06 leaanthony

I've published v2.9.1. LMK how you get on 👍

leaanthony avatar Jun 17 '24 20:06 leaanthony