The most interesting fact here is the following: it runs just fine
under gdb!
See shell log:
---------------------------------------------------------------------
[nsf @ gotris]$ ./gotris
Segmentation fault
[nsf @ gotris]$ gdb ./gotris
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html> This is free software: you are free
to change and redistribute it. There is NO WARRANTY, to the extent
permitted by law. Type "show copying" and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/nsf/projects/waytogo/gotris/gotris...
warning: Loadable segment ".interp" outside of ELF segments
done.
(gdb) run
Starting program: /home/nsf/projects/waytogo/gotris/gotris
Program exited normally.
(gdb) quit
---------------------------------------------------------------------
I've tried inserting fmt.Println as the usual way of debugging weird
errors in Go, but it doesn't print anything, e.g.:
func main() {
fmt.Println("hi")
...
}
Doesn't show anything. There are no 'init' functions around as well.
So, I believe the bug is somewhere in the runtime and it is somehow
connected with OpenGL, cgo and debuggers.
Giving the fact that there was some effort regarding improving gdb
support, probably that's the source of the bug.
> Have you had any luck tracing the source of the segmentation faults?
> I am experiencing the exact same thing (Go-OpenGL programs run fine in
> gdb but segfault when run directly).
Nope. I'm too lazy to fix Go's runtime bugs again. Hopefully Go devs
will do something about it.