sqweek / dialog

Simple cross-platform dialog API for go-lang
ISC License
516 stars 78 forks source link

Application crashes with `GTK+ 2.x symbols detected` when using gio #67

Open hrueschwein opened 2 years ago

hrueschwein commented 2 years ago

I'm making GUI application with Gio that uses GTK on linux, and application crashes on start (it's building well, breakes in dialog.init())

Stderr
(projectName:16641): Gtk-ERROR **: 18:56:14.917: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
SIGTRAP: trace trap
PC=0x7eff8415d92f m=0 sigcode=128
signal arrived during cgo execution

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x6f0e60, 0xc0000ddd00)
    /usr/lib/go-1.18/src/runtime/cgocall.go:157 +0x5c fp=0xc0000ddcd8 sp=0xc0000ddca0 pc=0x42b2bc
github.com/sqweek/dialog._Cfunc_gtk_init(0x0, 0x0)
    _cgo_gotypes.go:372 +0x45 fp=0xc0000ddd00 sp=0xc0000ddcd8 pc=0x6c26e5
github.com/sqweek/dialog.init.0()
    /home/dikey0ficial/go/pkg/mod/github.com/sqweek/dialog@v0.0.0-20220227145630-7a1c9e333fcf/dlgs_linux.go:19 +0x30 fp=0xc0000ddd20 sp=0xc0000ddd00 pc=0x6c2af0
runtime.doInit(0xc2c4a0)
    /usr/lib/go-1.18/src/runtime/proc.go:6222 +0x126 fp=0xc0000dde50 sp=0xc0000ddd20 pc=0x46a326
runtime.doInit(0xc300a0)
    /usr/lib/go-1.18/src/runtime/proc.go:6199 +0x71 fp=0xc0000ddf80 sp=0xc0000dde50 pc=0x46a271
runtime.main()
    /usr/lib/go-1.18/src/runtime/proc.go:233 +0x1d3 fp=0xc0000ddfe0 sp=0xc0000ddf80 pc=0x45d3d3
runtime.goexit()
    /usr/lib/go-1.18/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc0000ddfe8 sp=0xc0000ddfe0 pc=0x489001

rax    0x0
rbx    0x1
rcx    0xf
rdx    0x1629f33
rdi    0x7
rsi    0x15d0010
rbp    0x7fff5a833da0
rsp    0x7fff5a833d00
r8     0x1643240
r9     0x0
r10    0x7eff84af4040
r11    0x31c9c6bcdbafd93b
r12    0x6
r13    0x0
r14    0x7eff84231cc8
r15    0x7eff84231d50
rip    0x7eff8415d92f
rflags 0x202
cs     0x33
fs     0x0
gs     0x0
exit status 2

Enviroment info: OS: Kubuntu 21.10 x86_64 Go: go1.18.1 linux/amd64 dialog version: v0.0.0-20220227145630-7a1c9e333fcf gio version: v0.0.0-20220412071142-25fae8de30be GTK3 version: 3.24.30 GTK2 version: 2.24.33

sqweek commented 2 years ago

dialog uses gtk3 so that is presumably causing the conflict. But I previously used gtk2, so give commit f33030e0fda52e1958a2095d9fdf7b46c997f429 a try.

dialog development is slow so I don't think this version is missing any critical features/bug fixes, but it also probably wouldn't be much work to take HEAD and replace the current gtk backend with the gtk2 version. Ideally dialog would let you select the version I guess, but I'm unlikely to find time to look into support for backend selection

hrueschwein commented 2 years ago

Hello! I tried this. after a lot errors in console about deprecated API, this worked, but window is weird :)

image

P.S. Now I'm using ncurces/zenity, but I like this library more because of clearer syntax and many projects with it :)

sqweek commented 2 years ago

I don't understand what the screenshot is trying to tell me -- what is weird about it?

hrueschwein commented 2 years ago

what is weird about it?

icons are white and have to little width :)

sqweek commented 1 year ago

FYI I now have a project which uses dialog in conjunction with gio and haven't seen any issues on linux. Version info:

Linux version: Centos 7.7.1908
Go version: 1.21.0 (also 1.18.1)

github.com/sqweek/dialog v0.0.0-20220809060634-e981b270ebbf
gioui.org v0.1.0

GTK3 version: 3.24.26
GTK2 version: none

I don't know if gio has moved on or if something else in your project is relying on gtk2