Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wails 2.9.0 linux issue #3542

Open
lorypelli opened this issue Jun 16, 2024 · 11 comments · Fixed by #3545
Open

wails 2.9.0 linux issue #3542

lorypelli opened this issue Jun 16, 2024 · 11 comments · Fixed by #3545
Labels
Bug Something isn't working

Comments

@lorypelli
Copy link

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 lorypelli added the Bug Something isn't working label Jun 16, 2024
@makew0rld
Copy link

makew0rld commented Jun 16, 2024

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:

if(disableWebViewDragAndDrop)
{
gtk_drag_dest_unset(G_OBJECT(webview));
}

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
Copy link

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
Copy link

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
Copy link

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

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.

@lyimmi
Copy link
Contributor

lyimmi commented Jun 17, 2024

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.

leaanthony added a commit that referenced this issue Jun 17, 2024
@leaanthony
Copy link
Member

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
Copy link
Member

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

@makew0rld
Copy link

makew0rld commented Jun 17, 2024

Using the latest master (b40fd93) 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?

@lyimmi
Copy link
Contributor

lyimmi commented Jun 17, 2024

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.

@leaanthony
Copy link
Member

@lorypelli does the master branch work for you?

@leaanthony
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants