golang-ui / nuklear

This project provides Go bindings for nuklear.h — a small ANSI C GUI library.
https://github.com/vurtun/nuklear
MIT License
1.57k stars 98 forks source link

can't run nk-example #1

Closed F0rth closed 7 years ago

F0rth commented 7 years ago

Hi,

nk-example crash on my workstation, which infos can I provide to help debugging this issue ?

`[forth@mjolnir nk-example]$ go build -v github.com/golang-ui/glfw github.com/golang-ui/nuklear/nk

github.com/golang-ui/nuklear/nk

In file included from ../../nk/impl_glfw.go:16:0: ../../nk/nuklear_glfw_gl3.h: Dans la fonction ‘nk_glfw3_render’: ../../nk/nuklear_glfw_gl3.h:242:18: attention : assignment makes pointer from integer without a cast [-Wint-conversion] vertices = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); ^ ../../nk/nuklear_glfw_gl3.h:243:18: attention : assignment makes pointer from integer without a cast [-Wint-conversion] elements = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); ^ github.com/golang-ui/nuklear/cmd/nk-example`

`[forth@mjolnir nk-example]$ ./nk-example 2016/09/27 11:47:04 glfw: created window 400x500 fatal error: unexpected signal during runtime execution [signal SIGSEGV: segmentation violation code=0x1 addr=0x5d8cc002 pc=0x4f7098]

runtime stack: runtime.throw(0x57e87b, 0x2a) /usr/lib/go/src/runtime/panic.go:566 +0x95 runtime.sigpanic() /usr/lib/go/src/runtime/sigpanic_unix.go:12 +0x2cc

goroutine 1 [syscall, locked to thread]: runtime.cgocall(0x51a210, 0xc42004dae8, 0xc400000000) /usr/lib/go/src/runtime/cgocall.go:131 +0x110 fp=0xc42004da98 sp=0xc42004da58 github.com/golang-ui/nuklear/nk._Cfunc_nk_glfw3_render(0x8000000000001, 0x3f80000000020000) ??:0 +0x45 fp=0xc42004dae8 sp=0xc42004da98 github.com/golang-ui/nuklear/nk.NkGLFW3Render(0x8000000000001, 0x3f80000000020000) /home/forth/go/src/github.com/golang-ui/nuklear/nk/nk.go:3482 +0x39 fp=0xc42004db08 sp=0xc42004dae8 main.gfxMain(0x22a8090, 0x834bb0, 0xc42000c3c0) /home/forth/go/src/github.com/golang-ui/nuklear/cmd/nk-example/main.go:145 +0x2ba fp=0xc42004dd18 sp=0xc42004db08 main.main() /home/forth/go/src/github.com/golang-ui/nuklear/cmd/nk-example/main.go:87 +0x652 fp=0xc42004df48 sp=0xc42004dd18 runtime.main() /usr/lib/go/src/runtime/proc.go:183 +0x1f4 fp=0xc42004dfa0 sp=0xc42004df48 runtime.goexit() /usr/lib/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc42004dfa8 sp=0xc42004dfa0

goroutine 17 [syscall, locked to thread]: runtime.goexit() /usr/lib/go/src/runtime/asm_amd64.s:2086 +0x1

goroutine 5 [syscall]: os/signal.signal_recv(0x0) /usr/lib/go/src/runtime/sigqueue.go:116 +0x157 os/signal.loop() /usr/lib/go/src/os/signal/signal_unix.go:22 +0x22 created by os/signal.init.1 /usr/lib/go/src/os/signal/signal_unix.go:28 +0x41

goroutine 6 [select, locked to thread]: runtime.gopark(0x589010, 0x0, 0x57579a, 0x6, 0x18, 0x2) /usr/lib/go/src/runtime/proc.go:259 +0x13a runtime.selectgoImpl(0xc42002a730, 0x0, 0x18) /usr/lib/go/src/runtime/select.go:423 +0x11d9 runtime.selectgo(0xc42002a730) /usr/lib/go/src/runtime/select.go:238 +0x1c runtime.ensureSigM.func1() /usr/lib/go/src/runtime/signal1_unix.go:304 +0x2f3 runtime.goexit() /usr/lib/go/src/runtime/asm_amd64.s:2086 +0x1

goroutine 7 [select]: github.com/xlab/closer.(*closer).wait(0xc42007a000) /home/forth/go/src/github.com/xlab/closer/closer.go:102 +0x2a2 created by github.com/xlab/closer.newCloser /home/forth/go/src/github.com/xlab/closer/closer.go:94 +0x262`

xlab commented 7 years ago

@F0rth Thanks for the report, I honestly haven't tested it on Linux yet. Here nk_glfw3_render crashes for some reason. You can debug with GDB (go build -work, then gdb) if you want.

I want to research that case, could you provide you linux workstation config? uname, distro and GCC version especially.

xlab commented 7 years ago

@F0rth I switched to http://github.com/go-gl/glfw, this may help.

F0rth commented 7 years ago

so I put a breakpoint at 28 and nk-example crashed after the 74th line: ` 74 select { (gdb) n

Thread 1 "nk-example" received signal SIGSEGV, Segmentation fault. nk_draw_list_fill_poly_convex (list=list@entry=0x8375c8 <glfw+10984>, points=0xa3f470, points_count=4, color=..., aliasing=) at /home/forth/go/src/github.com/golang-ui/nuklear/nk/nuklear.h:6964 6964 ids[1] = (nk_draw_index)(vtx_inner_idx + ((i-1) << 1)); (gdb)

my config: distro: Archlinux

uname: Linux mjolnir 4.7.5-1-ARCH #1 SMP PREEMPT Sat Sep 24 13:04:22 CEST 2016 x86_64 GNU/Linux

go: go version go1.7.1 linux/amd64

gcc: Utilisation des specs internes. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/lto-wrapper Cible : x86_64-pc-linux-gnu Configuré avec: /build/gcc-multilib/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release Modèle de thread: posix gcc version 6.2.1 20160830 (GCC) `

haiitch commented 7 years ago

It compiles here (latest Ubuntu Xenial) but it crashes immediately after creating the application window.

xlab commented 7 years ago

@vruz thanks for the report, I'll try to debug this case on the next weekend, tomorrow gonna move to dotGo, so no time for playing with Linux.. :(

haiitch commented 7 years ago

No worries. I'd be willing to look into this problem and offload some of the work from you debugging it if you give me some rough pointers or starting directions where the problem could possibly occur. But no rush, I'll check back next week!

On 8 October 2016 at 17:38, Maxim Kupriianov notifications@github.com wrote:

@vruz https://github.com/vruz thanks for the report, I'll try to debug this case on the next weekend, tomorrow gonna move to dotGo, so no time for playing with Linux..

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/golang-ui/nuklear/issues/1#issuecomment-252447099, or mute the thread https://github.com/notifications/unsubscribe-auth/AABboiYddnsdsMMbVSlL8kKJd7FN9qLIks5qx_9JgaJpZM4KHduA .

xlab commented 7 years ago

Related #2, probably the nuklear_glfw_gl3.h backend for Nuklear should be replaced. Will research that this Saturday.

xlab commented 7 years ago

@F0rth @vruz guys sorry for delay. I've managed to run this thing on Windows, the problem with windows was that some old versions don't support OpenGL 3. So I migrated to OpenGL 2.1 backend and changed imports.

Please update the lib and check if this helps, because this should definitely do the trick.

haiitch commented 7 years ago

No worries, thank you for following up.

Re: Windows. I'm on Linux right now, but I'll test it and see what happens.

On 29 October 2016 at 09:45, Maxim Kupriianov notifications@github.com wrote:

@F0rth https://github.com/F0rth @vruz https://github.com/vruz guys sorry for delay. I've managed to run this thing on Windows, the problem with windows was that some old versions don't support OpenGL 3. So I migrated to OpenGL 2.1 backend and changed imports.

Please update the lib and check if this helps, because this should definitely do the trick.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/golang-ui/nuklear/issues/1#issuecomment-257089763, or mute the thread https://github.com/notifications/unsubscribe-auth/AABbonbsYWjJLspD9HOYQuT_hmPWrhGmks5q40AAgaJpZM4KHduA .

F0rth commented 7 years ago

it's working ! (on archlinux).

xlab commented 7 years ago

Gj everyone, thanks for the reports.