andlabs / ui

Platform-native GUI library for Go.
Other
8.33k stars 652 forks source link

native compilation on linux failed at launch #373

Closed jeromelesaux closed 4 years ago

jeromelesaux commented 4 years ago

I tried to compile my project on linux with the command line CGO_ENABLED=1 CC=gcc CXX=g++ go build. The compilation ended, and when I tried to execute binary I've got the followed stack : (process:1722): Gtk-CRITICAL **: 11:35:13.003: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:1722): Gtk-CRITICAL **: 11:35:13.004: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:1722): Gtk-CRITICAL **: 11:35:13.004: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed fatal error: unexpected signal during runtime execution [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x7f414fd76af0]

runtime stack: runtime.throw(0x75bbeb, 0x2a) /home/osboxes/go/src/runtime/panic.go:774 +0x72 runtime.sigpanic() /home/osboxes/go/src/runtime/signal_unix.go:378 +0x47c

goroutine 1 [syscall, locked to thread]: runtime.cgocall(0x692d50, 0xc000047eb0, 0xc000047ec0) /home/osboxes/go/src/runtime/cgocall.go:128 +0x5b fp=0xc000047e80 sp=0xc000047e48 pc=0x41820b github.com/andlabs/ui._Cfunc_uiNewEntry(0x0) _cgo_gotypes.go:2772 +0x4a fp=0xc000047eb0 sp=0xc000047e80 pc=0x4b261a github.com/andlabs/ui.NewEntry(0x97d8a0) /home/osboxes/godev/src/github.com/andlabs/ui/entry.go:37 +0x22 fp=0xc000047ed0 sp=0xc000047eb0 pc=0x4b6292 github.com/jeromelesaux/m4Ximpact/gui.init() /home/osboxes/godev/src/github.com/jeromelesaux/m4Ximpact/gui/browser.go:15 +0x26 fp=0xc000047f00 sp=0xc000047ed0 pc=0x690b46 runtime.doInit(0x97fca0) /home/osboxes/go/src/runtime/proc.go:5222 +0x8a fp=0xc000047f30 sp=0xc000047f00 pc=0x45042a runtime.doInit(0x97c220) /home/osboxes/go/src/runtime/proc.go:5217 +0x57 fp=0xc000047f60 sp=0xc000047f30 pc=0x4503f7 runtime.main() /home/osboxes/go/src/runtime/proc.go:190 +0x1da fp=0xc000047fe0 sp=0xc000047f60 pc=0x4440ea runtime.goexit() /home/osboxes/go/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc000047fe8 sp=0xc000047fe0 pc=0x46ebd1

How can I bypass this issue ?

os: debian The same project compile and run on a macOS X under Catalina (compilation on the macOS).

On a windows 10, compilation is ok but failed at launch without any stack..

andlabs commented 4 years ago

Can you paste a minimal reproducing example?

jeromelesaux commented 4 years ago

my code is available on GitHub, you can get it by a go get github.com/jeromelesaux/m4Ximpact. And try to compile it on a linux or windows. The compilation will succeed, but the application will crash at launch.

jeromelesaux commented 4 years ago

May you close this issue. I found my mistake. I invoke a NewEntry as global var (I don't know why I did it). I removed this allocation, and allocate this entry in a function and it works fine. Sorry for this issue.