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

go-qml with seg fault on windows 7 32 bit #109

Open
geraldstanje opened this issue Oct 6, 2014 · 29 comments
Open

go-qml with seg fault on windows 7 32 bit #109

geraldstanje opened this issue Oct 6, 2014 · 29 comments

Comments

@geraldstanje
Copy link

hi,

if i execute the following program i run into a seg fault:
here my test program:

package main

import (
    "fmt"
    "os"

    //"github.com/chai2010/qml"
    "gopkg.in/qml.v1"
)

func main() {
    if err := qml.Run(run); err != nil {
        fmt.Fprintf(os.Stderr, "error: %v\n", err)
        os.Exit(1)
    }
}

func run() error {
    engine := qml.NewEngine()
    engine.On("quit", func() { os.Exit(0) })

    component, err := engine.LoadString("hello.qml", qmlHello)
    if err != nil {
        return err
    }
    window := component.CreateWindow(nil)
    window.Show()
    window.Wait()
    return nil
}

const qmlHello = `
import QtQuick 2.2

Rectangle {
    id: page
    width: 320; height: 240
    color: "lightgray"

    Text {
        id: helloText
        text: "Hello world!"
        y: 30
        anchors.horizontalCenter: page.horizontalCenter
        font.pointSize: 24; font.bold: true
    }
}
`

i use go-qml on windows 7 32 bit with the following configuration:

  • go 1.3.1
    edit: same error with go 1.3.3
  • qt 5.3.2 (also tried qt 5.1.1): http://ftp.fau.de/qtproject/archive/qt/5.3/5.3.2/qt-opensource-windows-x86-mingw482_opengl-5.3.2.exe
  • gcc:
    C:\test\qml2\examples\tableview>gcc -v
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=C:/Qt/Qt5.3.2/Tools/mingw482_32/bin/../libexec/gcc/i686-w64-
    mingw32/4.8.2/lto-wrapper.exe
    Target: i686-w64-mingw32
    Configured with: ../../../src/gcc-4.8.2/configure --host=i686-w64-mingw32 --buil
    d=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c
    /mingw482/i686-482-posix-dwarf-rt_v3-rev3/mingw32 --with-gxx-include-dir=/mingw3
    2/i686-w64-mingw32/include/c++ --enable-shared --enable-static --disable-multili
    b --enable-languages=ada,c,c++,fortran,objc,obj-c++,lto --enable-libstdcxx-time=
    yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --en
    able-graphite --enable-checking=release --enable-fully-dynamic-string --enable-v
    ersion-specific-runtime-libs --disable-sjlj-exceptions --with-dwarf2 --disable-i
    sl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable
    -libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --d
    isable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with
    -arch=i686 --with-tune=generic --with-libiconv --with-system-zlib --with-gmp=/c/
    mingw482/prerequisites/i686-w64-mingw32-static --with-mpfr=/c/mingw482/prerequis
    ites/i686-w64-mingw32-static --with-mpc=/c/mingw482/prerequisites/i686-w64-mingw
    32-static --with-isl=/c/mingw482/prerequisites/i686-w64-mingw32-static --with-cl
    oog=/c/mingw482/prerequisites/i686-w64-mingw32-static --enable-cloog-backend=isl
    --with-pkgversion='i686-posix-dwarf-rev3, Built by MinGW-W64 project' --with-bu
    gurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/c/mingw482/i
    686-482-posix-dwarf-rt_v3-rev3/mingw32/opt/include -I/c/mingw482/prerequisites/i
    686-zlib-static/include -I/c/mingw482/prerequisites/i686-w64-mingw32-static/incl
    ude' CXXFLAGS='-O2 -pipe -I/c/mingw482/i686-482-posix-dwarf-rt_v3-rev3/mingw32/o
    pt/include -I/c/mingw482/prerequisites/i686-zlib-static/include -I/c/mingw482/pr
    erequisites/i686-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/c/mingw
    482/i686-482-posix-dwarf-rt_v3-rev3/mingw32/opt/lib -L/c/mingw482/prerequisites/
    i686-zlib-static/lib -L/c/mingw482/prerequisites/i686-w64-mingw32-static/lib -Wl
    ,--large-address-aware'
    Thread model: posix
    gcc version 4.8.2 (i686-posix-dwarf-rev3, Built by MinGW-W64 project)

i copied all dlls from C:\Qt\Qt5.3.2\5.3\mingw482_32\bin to the direcory of the executable, just to make sure i dont miss any dll...

the app crashes:
004e61a2_o

debug session with liteide, which comes with gdb:

// Run runs the main QML event loop, runs f, and then terminates the
// event loop once f returns.
//
// Most functions from the qml package block until Run is called.
//
// The Run function must necessarily be called from the same goroutine as
// the main function or the application may fail when running on Mac OS.
func Run(f func() error) error {
    if cdata.Ref() != guiMainRef {
        panic("Run must be called on the initial goroutine so apps are portable to Mac OS")
    }
    if !atomic.CompareAndSwapInt32(&initialized, 0, 1) {
        panic("qml.Run called more than once")
    }
    C.newGuiApplication()
    C.idleTimerInit((*C.int32_t)(&guiIdleRun))  <----- seg fault

to investigate this further, i started gdb without liteide:

(gdb) run
Starting program: C:\test\qml2\examples\tableview\hello.exe
[New Thread 6228.0x1ad4]
[New Thread 6228.0xaf0]
[New Thread 6228.0x940]
[New Thread 6228.0xa28]
warning: Invalid parameter passed to C runtime function.


Program received signal SIGSEGV, Segmentation fault.
0x75d4f4fc in msvcrt!_msize () from C:\Windows\system32\msvcrt.dll
(gdb) where
#0  0x75d4f4fc in msvcrt!_msize () from C:\Windows\system32\msvcrt.dll
#1  0x31874000 in ?? ()
#2  0x75d4f52c in msvcrt!.dllonexit () from C:\Windows\system32\msvcrt.dll
#3  0x004a3cc0 in ZN9IdleTimer18qt_static_metacallEP7QObjectN11QMetaObject4CallE
iPPv ()
#4  0x1d85ba07 in ?? ()
#5  0x004ad228 in mingw_onexit ()
#6  0x004a3cc0 in ZN9IdleTimer18qt_static_metacallEP7QObjectN11QMetaObject4CallE
iPPv ()
#7  0x0012fe78 in ?? ()
#8  0x00426545 in runtime.asmcgocall () at c:/go/src/pkg/runtime/asm_386.s:624
#9  0x005fb828 in ?? ()
#10 0x00000000 in ?? ()
(gdb) list
2
3       import (
4           "fmt"
5           "os"
6
7           //"github.com/chai2010/qml"
8               "gopkg.in/qml.v1"
9       )
10
11      func main() {
(gdb)
(gdb) backtrace full
#0  0x75d4f4fc in msvcrt!_msize () from C:\Windows\system32\msvcrt.dll
No symbol table info available.
#1  0x31874000 in ?? ()
No symbol table info available.
#2  0x75d4f52c in msvcrt!.dllonexit () from C:\Windows\system32\msvcrt.dll
No symbol table info available.
#3  0x004a3cc0 in ZN9IdleTimer18qt_static_metacallEP7QObjectN11QMetaObject4CallE
iPPv ()
No locals.
#4  0x1d85ba07 in ?? ()
No symbol table info available.
#5  0x004ad228 in mingw_onexit ()
No locals.
#6  0x004a3cc0 in ZN9IdleTimer18qt_static_metacallEP7QObjectN11QMetaObject4CallE
iPPv ()
No locals.
#7  0x0012fe78 in ?? ()
No symbol table info available.
#8  0x00426545 in runtime.asmcgocall () at c:/go/src/pkg/runtime/asm_386.s:624
No locals.
#9  0x005fb828 in ?? ()
No symbol table info available.
#10 0x00000000 in ?? ()
No symbol table info available.
(gdb)

from what i see, the issue is caused by the timer!?

@geraldstanje geraldstanje changed the title golang qml with seg fault on windows 7 32 bit go-qml with seg fault on windows 7 32 bit Oct 6, 2014
@geraldstanje
Copy link
Author

i added the gdb output, i hope that helps to find the bug!?

@geraldstanje
Copy link
Author

@niemeyer do you have time to look at it or do you need more infos?

@niemeyer
Copy link
Contributor

niemeyer commented Oct 7, 2014

The debug run doesn't really show much. The most interesting information there is this line:

warning: Invalid parameter passed to C runtime function.

Would be worth finding out which function and parameter is being complained about. Unfortunately, I don't have a Windows environment where I might debug this, so we'll need someone able to look at it.

@geraldstanje
Copy link
Author

i could investigate more, how can i figure the function gdb is complaining? single step until the message appears?

@niemeyer
Copy link
Contributor

niemeyer commented Oct 7, 2014

Single step would be painful. Try stepping over the main lines, and then once you figure out where it's coming from, step into the specific function failing.

Would also be worth finding out what's going on when asmcgocall is failing. The actual crash point reported is apparently within exit finalizers, which might imply the real issue is being hidden by these errors.

@geraldstanje
Copy link
Author

@niemeyer some more debug infos:
@niemeyer could you check if the params to runtime·cgocall(void (fn)(void), void *arg) are correct?

56              C.idleTimerInit((*C.int32_t)(&guiIdleRun))
(gdb) s
gopkg.in/qml%2ev1._Cfunc_idleTimerInit ()
    at gopkg.in/qml.v1/_obj/_cgo_defun.c:256
256     gopkg.in/qml.v1/_obj/_cgo_defun.c: No such file or directory.
(gdb) s
gopkg.in/qml%2ev1._Cfunc_idleTimerInit ()
    at gopkg.in/qml.v1/_obj/_cgo_defun.c:258
258     in gopkg.in/qml.v1/_obj/_cgo_defun.c
(gdb) s
runtime.cgocall () at c:/go/src/pkg/runtime/cgocall.c:98
98      runtime·cgocall(void (*fn)(void*), void *arg)
(gdb) s
runtime.cgocall () at c:/go/src/pkg/runtime/cgocall.c:102
102             if(!runtime·iscgo && !Solaris && !Windows)
(gdb) s
105             if(fn == 0)
(gdb) s
112             if(runtime·needextram && runtime·cas(&runtime·needextram, 1,
0))
(gdb) s
115             m->ncgocall++;
(gdb) s
121             runtime·lockOSThread();
(gdb) n
122             d.fn = &endcgoV;
(gdb) n
123             d.siz = 0;
(gdb) n
124             d.link = g->defer;
(gdb) n
125             d.argp = NoArgs;
(gdb) n
126             d.special = true;
(gdb) n
127             g->defer = &d;
(gdb) n
129             m->ncgo++;
(gdb) n
142             runtime·entersyscall();
(gdb) n
143             runtime·asmcgocall(fn, arg);
(gdb) s
runtime.asmcgocall () at c:/go/src/pkg/runtime/asm_386.s:601
601             MOVL    fn+0(FP), AX
(gdb) n
602             MOVL    arg+4(FP), BX
(gdb) n
603             MOVL    SP, DX
(gdb) n
608             get_tls(CX)
(gdb) n
609             MOVL    m(CX), BP
(gdb) n
610             MOVL    m_g0(BP), SI
(gdb) n
611             MOVL    g(CX), DI
(gdb) n
612             CMPL    SI, DI
(gdb) n
613             JEQ     4(PC)
(gdb) n
614             CALL    gosave<>(SB)
(gdb) n
615             MOVL    SI, g(CX)
(gdb) n
616             MOVL    (g_sched+gobuf_sp)(SI), SP
(gdb) n
runtime.asmcgocall () at c:/go/src/pkg/runtime/asm_386.s:619
619             SUBL    $32, SP
(gdb) n
runtime.asmcgocall () at c:/go/src/pkg/runtime/asm_386.s:620
620             ANDL    $~15, SP        // alignment, perhaps unnecessary
(gdb) n
runtime.asmcgocall () at c:/go/src/pkg/runtime/asm_386.s:621
621             MOVL    DI, 8(SP)       // save g
(gdb) n
622             MOVL    DX, 4(SP)       // save SP
(gdb) n
623             MOVL    BX, 0(SP)       // first argument in x86-32 ABI
(gdb) n
624             CALL    AX
(gdb) n
warning: Invalid parameter passed to C runtime function.

@geraldstanje
Copy link
Author

@niemeyer is this debug output useful to find the issue?

@niemeyer
Copy link
Contributor

niemeyer commented Oct 9, 2014

Not much.. still have no idea about which function it's complaining about.

@niemeyer niemeyer closed this as completed Oct 9, 2014
@niemeyer niemeyer reopened this Oct 9, 2014
@niemeyer
Copy link
Contributor

niemeyer commented Oct 9, 2014

Actually, it does give a hint.. it might be something around the memory fencing that is done in the idle timer.

@geraldstanje
Copy link
Author

whats wrong here? gopkg.in/qml.v1/_obj/_cgo_defun.c: No such file or directory.

@niemeyer
Copy link
Contributor

niemeyer commented Oct 9, 2014

That file is generated by cgo. You can have a look at it by preserving the work directory during build with -work, but that file is not very interesting. Given the name, you can guess that the real work is done by idleTimerInit, in idletimer.cpp.

@geraldstanje
Copy link
Author

idleTimerInit doesnt have anything windows specific!?
dont you need to synchronize this->guiIdleRun = guiIdleRun; as well?

@niemeyer
Copy link
Contributor

niemeyer commented Oct 9, 2014

The code there was already tweaked quite a bit so it actually worked on Windows, and it did work. I don't know what's wrong for your case, and we'll likely need someone that has more familiarity with the environment to tell.

@neclepsio
Copy link

Gerald, have you tested with go 1.2? It worked for me (but even 1.3 did
before). I cannot test soon but if it works for you maybe Gustavo can
understand something more.
Il 09/ott/2014 17:37 "Gustavo Niemeyer" notifications@github.com ha
scritto:

The code there was already tweaked quite a bit so it actually worked on
Windows, and it did work. I don't know what's wrong for your case, and
we'll likely need someone that has more familiarity with the environment to
tell.


Reply to this email directly or view it on GitHub
#109 (comment).

@geraldstanje
Copy link
Author

necl : no i have not...

@niemeyer some more debug output:

=thread-group-added,id="i1"
~"GNU gdb (GDB) 7.7\n"
~"Copyright (C) 2014 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show warranty\" for details.\n"
~"This GDB was configured as \"i686-w64-mingw32\".\nType \"show configuration\" for configuration details."
~"\nFor bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n"
~"For help, type \"help\".\n"
~"Type \"apropos word\" to search for commands related to \"word\"...\n"
>>> 10000010-break-insert C:/test/qml2/examples/tableview/hello.go:12~"Reading symbols from tableview.exe..."
~"done.\n"
(gdb) 
&"set unwindonsignal on\n"
=cmd-param-changed,param="unwindonsignal",value="on"
10000001^done
(gdb) 
&"set overload-resolution off\n"
=cmd-param-changed,param="overload-resolution",value="off"
10000002^done
(gdb) 
&"handle SIGSEGV nopass stop print\n"
~"Signal        Stop\tPrint\tPass to program\tDescription\n"
~"SIGSEGV       Yes\tYes\tNo\t\tSegmentation fault\n"
10000003^done
(gdb) 
&"set breakpoint pending on\n"
=cmd-param-changed,param="breakpoint pending",value="on"
10000004^done
(gdb) 
&"set width 0\n"
=cmd-param-changed,param="width",value="4294967295"
10000005^done
(gdb) 
&"set height 0\n"
10000006^done
(gdb) 
&"set auto-solib-add on\n"
10000007^done
(gdb) 
10000008^done,source-path="c:/go/src/pkg/runtime;$cdir;$cwd"
(gdb) 
&"set substitute-path /go/src/pkg/runtime c:/go/src/pkg/runtime\n"
10000009^done
(gdb) 
10000010^error,msg="No source file named C:/test/qml2/examples/tableview/hello.go."
(gdb) 
10000011^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00401060",func="main.main",file="C:/test/qml2/examples/tableview/tableview.go",fullname="C:\\test\\qml2\\examples\\tableview\\tableview.go",line="15",thread-groups=["i1"],times="0",original-location="main.main"}
(gdb) 
=thread-group-started,id="i1",pid="7520"
=thread-created,id="1",group-id="i1"
~"[New Thread 7520.0x1728]\n"
10000012^running
*running,thread-id="all"
(gdb) 
&"warning: Can not parse XML library list; XML support was disabled at compile time\n"
=thread-created,id="2",group-id="i1"
~"[New Thread 7520.0x2200]\n"
*running,thread-id="all"
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00401060",func="main.main",file="C:/test/qml2/examples/tableview/tableview.go",fullname="C:\\\\test\\\\qml2\\\\examples\\\\tableview\\\\tableview.go",line="15",thread-groups=["i1"],times="1",original-location="main.main"}
*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x00401060",func="main.main",args=[],file="C:/test/qml2/examples/tableview/tableview.go",fullname="C:\\test\\qml2\\examples\\tableview\\tableview.go",line="15"},thread-id="1",stopped-threads="all"
(gdb) 
>>> 10000016-var-create - @ err10000013^done,changelist=[]
(gdb) 
10000014^done,variables=[{name="err"}]
(gdb) 
10000015^done,stack=[frame={level="0",addr="0x00401060",func="main.main",file="C:/test/qml2/examples/tableview/tableview.go",fullname="C:\\test\\qml2\\examples\\tableview\\tableview.go",line="15"}]
(gdb) 
>>> 10000017-var-list-children 1 var110000016^done,name="var1",numchild="2",value="{...}",type="error",thread-id="1",has_more="0"
(gdb) 
10000017^done,numchild="2",children=[child={name="var1.tab",exp="tab",numchild="6",value="0x0",type="runtime.itab *",thread-id="1"},child={name="var1.data",exp="data",numchild="0",value="0x37c0e8",type="void *",thread-id="1"}],has_more="0"
(gdb) 
10000018^running
*running,thread-id="1"
(gdb) 
*running,thread-id="all"
*stopped,reason="end-stepping-range",frame={addr="0x0040107f",func="main.main",args=[],file="C:/test/qml2/examples/tableview/tableview.go",fullname="C:\\test\\qml2\\examples\\tableview\\tableview.go",line="16"},thread-id="1",stopped-threads="all"
(gdb) 
>>> 10000022-var-evaluate-expression var1.tab>>> 10000023-var-evaluate-expression var1.data10000019^done,changelist=[{name="var1.tab",in_scope="true",type_changed="false",has_more="0"},{name="var1.data",in_scope="true",type_changed="false",has_more="0"}]
(gdb) 
10000020^done,variables=[{name="err"}]
(gdb) 
10000021^done,stack=[frame={level="0",addr="0x0040107f",func="main.main",file="C:/test/qml2/examples/tableview/tableview.go",fullname="C:\\test\\qml2\\examples\\tableview\\tableview.go",line="16"}]
(gdb) 
10000022^done,value="0x442761 <gopkg.in/qml%2ev1.init\302\2673+33>"
(gdb) 
10000023^done,value="0x448ec9 <gopkg.in/qml%2ev1.init+1609>"
(gdb) 
10000024^running
*running,thread-id="all"
(gdb) 
*stopped,reason="end-stepping-range",frame={addr="0x0043c0c0",func="gopkg.in/qml%2ev1.Run",args=[{name="~r1",value="..."}],file="H:/gopath/src/gopkg.in/qml.v1/bridge.go",fullname="H:\\gopath\\src\\gopkg.in\\qml.v1\\bridge.go",line="48"},thread-id="1",stopped-threads="all"
(gdb) 
>>> 10000028-var-delete var1>>> 10000029-var-create - @ &f>>> 10000030-var-create - @ &done>>> 10000031-var-create - @ ~r110000025^done,changelist=[{name="var1",in_scope="false",type_changed="false",has_more="0"}]
(gdb) 
10000026^done,variables=[{name="&f"},{name="&done"},{name="~r1",arg="1"}]
(gdb) 
10000027^done,stack=[frame={level="0",addr="0x0043c0c0",func="gopkg.in/qml%2ev1.Run",file="H:/gopath/src/gopkg.in/qml.v1/bridge.go",fullname="H:\\gopath\\src\\gopkg.in\\qml.v1\\bridge.go",line="48"},frame={level="1",addr="0x0040108c",func="main.main",file="C:/test/qml2/examples/tableview/tableview.go",fullname="C:\\test\\qml2\\examples\\tableview\\tableview.go",line="16"}]
(gdb) 
10000028^done,ndeleted="3"
(gdb) 
10000029^error,msg="-var-create: unable to create variable object"
(gdb) 
10000030^error,msg="-var-create: unable to create variable object"
(gdb) 
10000031^error,msg="-var-create: unable to create variable object"
(gdb) 
10000032^running
*running,thread-id="all"
(gdb) 
*stopped,reason="end-stepping-range",frame={addr="0x00421c60",func="runtime.new",args=[],file="c:/go/src/pkg/runtime/malloc.goc",fullname="c:\\go\\src\\pkg\\runtime\\malloc.goc",line="826"},thread-id="1",stopped-threads="all"
(gdb) 
10000033^done,changelist=[]
(gdb) 
10000034^done,variables=[]
(gdb) 
10000035^done,stack=[frame={level="0",addr="0x00421c60",func="runtime.new",file="c:/go/src/pkg/runtime/malloc.goc",fullname="c:\\go\\src\\pkg\\runtime\\malloc.goc",line="826"},frame={level="1",addr="0x0043c0ee",func="gopkg.in/qml%2ev1.Run",file="H:/gopath/src/gopkg.in/qml.v1/bridge.go",fullname="H:\\gopath\\src\\gopkg.in\\qml.v1\\bridge.go",line="48"},frame={level="2",addr="0x00501f00",func="type.*"},frame={level="3",addr="0x31877840",func="??"}]
(gdb) 
10000036^running
*running,thread-id="all"
(gdb) 
*stopped,reason="end-stepping-range",frame={addr="0x00421c67",func="runtime.new",args=[],file="c:/go/src/pkg/runtime/malloc.goc",fullname="c:\\go\\src\\pkg\\runtime\\malloc.goc",line="828"},thread-id="1",stopped-threads="all"
(gdb) 
10000037^done,changelist=[]
(gdb) 
10000038^done,variables=[]
(gdb) 
10000039^done,stack=[frame={level="0",addr="0x00421c67",func="runtime.new",file="c:/go/src/pkg/runtime/malloc.goc",fullname="c:\\go\\src\\pkg\\runtime\\malloc.goc",line="828"},frame={level="1",addr="0x00000001",func="??"}]
(gdb) 
10000040^running
*running,thread-id="all"
(gdb) 
*stopped,reason="end-stepping-range",frame={addr="0x00421c6f",func="runtime.new",args=[],file="c:/go/src/pkg/runtime/malloc.goc",fullname="c:\\go\\src\\pkg\\runtime\\malloc.goc",line="826"},thread-id="1",stopped-threads="all"
(gdb) 
10000041^done,changelist=[]
(gdb) 
10000042^done,variables=[]
(gdb) 
10000043^done,stack=[frame={level="0",addr="0x00421c6f",func="runtime.new",file="c:/go/src/pkg/runtime/malloc.goc",fullname="c:\\go\\src\\pkg\\runtime\\malloc.goc",line="826"},frame={level="1",addr="0x00000001",func="??"}]
(gdb) 
10000044^running
*running,thread-id="all"
(gdb) 
=thread-created,id="3",group-id="i1"
~"[New Thread 7520.0x264c]\n"
*running,thread-id="all"
=thread-created,id="4",group-id="i1"
~"[New Thread 7520.0x22c8]\n"
*running,thread-id="all"
*stopped,reason="end-stepping-range",frame={addr="0x00421c99",func="runtime.new",args=[],file="c:/go/src/pkg/runtime/malloc.goc",fullname="c:\\go\\src\\pkg\\runtime\\malloc.goc",line="827"},thread-id="1",stopped-threads="all"
(gdb) 
10000045^done,changelist=[]
(gdb) 
10000046^done,variables=[]
(gdb) 
10000047^done,stack=[frame={level="0",addr="0x00421c99",func="runtime.new",file="c:/go/src/pkg/runtime/malloc.goc",fullname="c:\\go\\src\\pkg\\runtime\\malloc.goc",line="827"},frame={level="1",addr="0x00000008",func="??"}]
(gdb) 
10000048^running
*running,thread-id="all"
(gdb) 
*stopped,reason="end-stepping-range",frame={addr="0x0043c10c",func="gopkg.in/qml%2ev1.Run",args=[{name="~r1",value="..."}],file="H:/gopath/src/gopkg.in/qml.v1/bridge.go",fullname="H:\\gopath\\src\\gopkg.in\\qml.v1\\bridge.go",line="49"},thread-id="1",stopped-threads="all"
(gdb) 
>>> 10000052-var-create - @ &f>>> 10000053-var-create - @ &done>>> 10000054-var-create - @ ~r110000049^done,changelist=[]
(gdb) 
10000050^done,variables=[{name="&f"},{name="&done"},{name="~r1",arg="1"}]
(gdb) 
10000051^done,stack=[frame={level="0",addr="0x0043c10c",func="gopkg.in/qml%2ev1.Run",file="H:/gopath/src/gopkg.in/qml.v1/bridge.go",fullname="H:\\gopath\\src\\gopkg.in\\qml.v1\\bridge.go",line="49"},frame={level="1",addr="0x00501f00",func="type.*"},frame={level="2",addr="0x3188c1c0",func="??"}]
(gdb) 
10000052^error,msg="-var-create: unable to create variable object"
(gdb) 
10000053^error,msg="-var-create: unable to create variable object"
(gdb) 
10000054^error,msg="-var-create: unable to create variable object"
(gdb) 
10000055^running
*running,thread-id="all"
(gdb) 
*stopped,reason="end-stepping-range",frame={addr="0x0043c158",func="gopkg.in/qml%2ev1.Run",args=[{name="~r1",value="..."}],file="H:/gopath/src/gopkg.in/qml.v1/bridge.go",fullname="H:\\gopath\\src\\gopkg.in\\qml.v1\\bridge.go",line="52"},thread-id="1",stopped-threads="all"
(gdb) 
>>> 10000059-var-create - @ &f>>> 10000060-var-create - @ &done>>> 10000061-var-create - @ ~r110000056^done,changelist=[]
(gdb) 
10000057^done,variables=[{name="&f"},{name="&done"},{name="~r1",arg="1"}]
(gdb) 
10000058^done,stack=[frame={level="0",addr="0x0043c158",func="gopkg.in/qml%2ev1.Run",file="H:/gopath/src/gopkg.in/qml.v1/bridge.go",fullname="H:\\gopath\\src\\gopkg.in\\qml.v1\\bridge.go",line="52"},frame={level="1",addr="0x0061b720",func="??"}]
(gdb) 
10000059^error,msg="-var-create: unable to create variable object"
(gdb) 
10000060^error,msg="-var-create: unable to create variable object"
(gdb) 
10000061^error,msg="-var-create: unable to create variable object"
(gdb) 
10000062^running
*running,thread-id="all"
(gdb) 
*stopped,reason="end-stepping-range",frame={addr="0x0043c1ba",func="gopkg.in/qml%2ev1.Run",args=[{name="~r1",value="..."}],file="H:/gopath/src/gopkg.in/qml.v1/bridge.go",fullname="H:\\gopath\\src\\gopkg.in\\qml.v1\\bridge.go",line="55"},thread-id="1",stopped-threads="all"
(gdb) 
>>> 10000066-var-create - @ &f>>> 10000067-var-create - @ &done>>> 10000068-var-create - @ ~r110000063^done,changelist=[]
(gdb) 
10000064^done,variables=[{name="&f"},{name="&done"},{name="~r1",arg="1"}]
(gdb) 
10000065^done,stack=[frame={level="0",addr="0x0043c1ba",func="gopkg.in/qml%2ev1.Run",file="H:/gopath/src/gopkg.in/qml.v1/bridge.go",fullname="H:\\gopath\\src\\gopkg.in\\qml.v1\\bridge.go",line="55"},frame={level="1",addr="0x0061c9f8",func="??"}]
(gdb) 
10000066^error,msg="-var-create: unable to create variable object"
(gdb) 
10000067^error,msg="-var-create: unable to create variable object"
(gdb) 
10000068^error,msg="-var-create: unable to create variable object"
(gdb) 
10000069^running
*running,thread-id="all"
(gdb) 
*stopped,reason="end-stepping-range",frame={addr="0x0043c1bf",func="gopkg.in/qml%2ev1.Run",args=[{name="~r1",value="..."}],file="H:/gopath/src/gopkg.in/qml.v1/bridge.go",fullname="H:\\gopath\\src\\gopkg.in\\qml.v1\\bridge.go",line="56"},thread-id="1",stopped-threads="all"
(gdb) 
>>> 10000073-var-create - @ &f>>> 10000074-var-create - @ &done>>> 10000075-var-create - @ ~r110000070^done,changelist=[]
(gdb) 
10000071^done,variables=[{name="&f"},{name="&done"},{name="~r1",arg="1"}]
(gdb) 
10000072^done,stack=[frame={level="0",addr="0x0043c1bf",func="gopkg.in/qml%2ev1.Run",file="H:/gopath/src/gopkg.in/qml.v1/bridge.go",fullname="H:\\gopath\\src\\gopkg.in\\qml.v1\\bridge.go",line="56"},frame={level="1",addr="0x0061c9f8",func="??"}]
(gdb) 
10000073^error,msg="-var-create: unable to create variable object"
(gdb) 
10000074^error,msg="-var-create: unable to create variable object"
(gdb) 
10000075^error,msg="-var-create: unable to create variable object"
(gdb) 
>>> 10000076-var-create - * guiIdleRun10000076^error,msg="-var-create: unable to create variable object"
(gdb) 
10000077^running
*running,thread-id="all"
(gdb) 
&"warning: Invalid parameter passed to C runtime function.\n"
&"\n"
*stopped,reason="signal-received",signal-name="SIGSEGV",signal-meaning="Segmentation fault",frame={addr="0x75bcf4fc",func="??",args=[]},thread-id="1",stopped-threads="all"
(gdb) 
10000078^done,changelist=[]
(gdb) 
10000079^done,variables=[]
(gdb) 
10000080^done,stack=[frame={level="0",addr="0x75bcf4fc",func="??"},frame={level="1",addr="0x75bcf52c",func="??"},frame={level="2",addr="0x004baec8",func="mingw_onexit"},frame={level="3",addr="0x004b1960",func="ZN9IdleTimer18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv"},frame={level="4",addr="0x0012fe78",func="??"},frame={level="5",addr="0x00427105",func="runtime.asmcgocall",file="c:/go/src/pkg/runtime/asm_386.s",fullname="c:\\go\\src\\pkg\\runtime\\asm_386.s",line="624"},frame={level="6",addr="0x0061c9e8",func="??"},frame={level="7",addr="0x00000000",func="??"}]
(gdb) 
10000081^error,msg="Cannot find bounds of current function"
(gdb) 
10000082^error,msg="Cannot find bounds of current function"
(gdb) 
10000083^error,msg="Cannot find bounds of current function"
(gdb) 
10000084^error,msg="Cannot find bounds of current function"
(gdb) 
10000085^error,msg="Cannot find bounds of current function"
(gdb) 
10000086^error,msg="Cannot find bounds of current function"
(gdb) 
10000087^error,msg="Cannot find bounds of current function"
(gdb) 
10000088^error,msg="Cannot find bounds of current function"
(gdb) 
10000089^error,msg="Cannot find bounds of current function"
(gdb) 
10000090^error,msg="Cannot find bounds of current function"
(gdb) 
10000091^error,msg="Cannot find bounds of current function"
(gdb) 
10000092^error,msg="Cannot find bounds of current function"
(gdb) 
10000093^error,msg="Cannot find bounds of current function"
(gdb) 
(gdb) 
10000094^running
*running,thread-id="all"
(gdb) 
*stopped,reason="signal-received",signal-name="SIGSEGV",signal-meaning="Segmentation fault",frame={addr="0x75bcf4fc",func="??",args=[]},thread-id="1",stopped-threads="all"
(gdb) 
10000095^done,changelist=[]
(gdb) 
10000096^done,variables=[]
(gdb) 
(gdb) 
10000094^running
*running,thread-id="all"
(gdb) 
*stopped,reason="signal-received",signal-name="SIGSEGV",signal-meaning="Segmentation fault",frame={addr="0x75bcf4fc",func="??",args=[]},thread-id="1",stopped-threads="all"
(gdb) 
10000095^done,changelist=[]
(gdb) 
10000096^done,variables=[]
(gdb) 
10000097^done,stack=[frame={level="0",addr="0x75bcf4fc",func="??"},frame={level="1",addr="0x75bcf52c",func="??"},frame={level="2",addr="0x004baec8",func="mingw_onexit"},frame={level="3",addr="0x004b1960",func="ZN9IdleTimer18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv"},frame={level="4",addr="0x0012fe78",func="??"},frame={level="5",addr="0x00427105",func="runtime.asmcgocall",file="c:/go/src/pkg/runtime/asm_386.s",fullname="c:\\go\\src\\pkg\\runtime\\asm_386.s",line="624"},frame={level="6",addr="0x0061c9e8",func="??"},frame={level="7",addr="0x00000000",func="??"}]
(gdb) 

@geraldstanje
Copy link
Author

@neclepsio: same error with go 1.2.2

@felixrabe
Copy link

Same issue, segfault at qml.Run, with Windows 7 32-bit, Go 1.3.3 (official package from golang.org), MSYS2, Qt 5.3.2 (installed via MSYS2 pacman, mingw-w64-i686-qt5).

Compiling the Qt Gui examples (qmake && make) worked, running the analogclock example works too. Haven't tested more so fare.

@erezwanderman
Copy link

Tried to run the test program in this issue and the example in "examples/controls/basiclayouts". Here are the results:

Machine 1: Windows 7 32-bit, Go 1.3.1, Qt 5.3.2:

Starts and workds well!

Machine 2: VM, Windows 10 Technical preview x64, Go 1.3.3, Qt 5.3.2:

Starts (not crashing like OP) but shows empty white window. A lot of messages in the console.

Qt: Untested Windows version 6.4 detected!
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glGenBuffers'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glGenBuffersOES'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glGenBuffersARB'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glGenBuffersEXT'
2014/10/28 17:24:40 qopenglbuffer.cpp:419: QOpenGLBuffer::bind(): buffer not created
2014/10/28 17:24:40 qopenglbuffer.cpp:384: QOpenGLBuffer::allocate(): buffer not created
2014/10/28 17:24:40 qopenglbuffer.cpp:450: QOpenGLBuffer::release(): buffer not created
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindFramebuffer'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindFramebufferOES'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindFramebufferARB'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindFramebufferEXT'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glGenBuffers'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glGenBuffersOES'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glGenBuffersARB'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glGenBuffersEXT'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBuffer'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBufferOES'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBufferARB'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBufferEXT'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBufferData'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBufferDataOES'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBufferDataARB'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBufferDataEXT'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBuffer'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBufferOES'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBufferARB'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBufferEXT'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBuffer'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBufferOES'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBufferARB'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBufferEXT'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glCreateProgram'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glCreateProgramARB'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glCreateProgramObject'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glCreateProgramObjectARB'
2014/10/28 17:24:40 qopenglshaderprogram.cpp:686: QOpenGLShaderProgram: could not create shader program
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glCreateShader'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glCreateShaderARB'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glCreateShaderObject'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glCreateShaderObjectARB'
2014/10/28 17:24:40 qopenglshaderprogram.cpp:252: QOpenGLShader: could not create shader
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glCreateShader'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glCreateShaderARB'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glCreateShaderObject'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glCreateShaderObjectARB'
2014/10/28 17:24:40 qopenglshaderprogram.cpp:252: QOpenGLShader: could not create shader
2014/10/28 17:24:40 qsgcontext.cpp:637: shader compilation failed:
""
2014/10/28 17:24:40 qopenglshaderprogram.cpp:1781: QOpenGLShaderProgram::uniformLocation( matrix ): shader program is not linked
2014/10/28 17:24:40 qopenglshaderprogram.cpp:1781: QOpenGLShaderProgram::uniformLocation( opacity ): shader program is not linked
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBuffer'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBufferOES'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBufferARB'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBufferEXT'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBuffer'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBufferOES'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBufferARB'
2014/10/28 17:24:40 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glBindBufferEXT'
2014/10/28 17:24:45 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glDeleteBuffers'
2014/10/28 17:24:45 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glDeleteBuffersOES'
2014/10/28 17:24:45 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glDeleteBuffersARB'
2014/10/28 17:24:45 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glDeleteBuffersEXT'
2014/10/28 17:24:45 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glDeleteBuffers'
2014/10/28 17:24:45 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glDeleteBuffersOES'
2014/10/28 17:24:45 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glDeleteBuffersARB'
2014/10/28 17:24:45 qwindowsglcontext.cpp:1124: getProcAddress: Unable to resolve 'glDeleteBuffersEXT'

@bcampbell
Copy link

I'm getting a crash on 64bit windows which seems similar.
I get an access violation, seemingly before main().
Running in gdb I get that "warning: Invalid parameter passed to C runtime function" warning.

details:
Windows 7 (64bit)
Go 1.3.3 amd64 (.msi installer from golang.org)
Prebuilt QT 5.3.2 from http://tver-soft.org/qt64 (These come with the mingw-w64 compiler they were compiled with, so I just added that included mingw-w64 to my path so I'd be using the same gcc. I tried both SEH and SJLJ flavours, and posix threads, but not win32 threads).
I also installed GTK 3.6.4, just for pkg-config :- )

My stripped down crashy program:

package main

import (
    "gopkg.in/qml.v1"
)

func main() {
    qml.Run(run)
}


func run() error {
    return nil
}

I can compile and run a simple cgo 'hello world' ok.
I can also get go-qml working without problem on windows using 32bit go and mingw32. The problem is purely with getting a 64bit version going.

Next step I think is to try compiling my own QT from source, on mingw-w64 (not looking forward to that...). I'll probably try msys2 & pacman first, just of the off chance.

I don't really expect any solutions, just wanted to add some more data!

@Chironian
Copy link

I faced the problem same as you, too.
However, it was settled by building Qt 5.3.2 using qt-5.3.1-x64-mingw482r4-seh.exe.

@geraldstanje
Copy link
Author

can you try go 1.4 rc2?

@geraldstanje
Copy link
Author

new output with go 1.4 rc2:

C:\qmlTest>qmlApp.exe
Exception 0xc0000005 0x1 0x0 0x76def4fc
PC=0x76def4fc
signal arrived during cgo execution

gopkg.in/qml%2ev1._Cfunc_idleTimerInit(0x61b2d8)
        H:/gopath/src/gopkg.in/qml.v1/:191 +0x3f
gopkg.in/qml%2ev1.Run(0x5586ac, 0x0, 0x0)
        H:/gopath/src/gopkg.in/qml.v1/bridge.go:56 +0x107
main.main()
        C:/qmlTest/qmlApp.go:12 +0x29

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
        c:/go/src/runtime/asm_386.s:2287 +0x1
eax     0x4b1880
ebx     0x12fe6c
ecx     0x0
edx     0x0
edi     0xffffffff
esi     0x12fe68
ebp     0x12fe10
esp     0x12fe0c
eip     0x76def4fc
eflags  0x10286
cs      0x1b
fs      0x3b
gs      0x0

tested with both qt 5.1.1 and qt 5.3.2

@Chironian
Copy link

Hi,

Sorry, my trouble is same as Mr. bcampbell's trouble.
And I found that this trouble is known bug of ANGLE built by gcc 4.9.
https://code.google.com/p/angleproject/issues/detail?id=651
My trouble was gone by this patch for MinGW-w64 4.9.1.
And I think that this is not same as Mr. geraldstanje's trouble.

regards.

@geraldstanje
Copy link
Author

does it also work with mingw 4.9.1 - 32 bit?
did you use Minimalist GNU for Windows http://www.mingw.org/ ?

@Chironian
Copy link

does it also work with mingw 4.9.1 - 32 bit?

Yes, crash is reproduced on Qt5.3.2 built by MinGW 4.9.1 rev.2 32bit, and is gone by ANGLE patch.

did you use Minimalist GNU for Windows http://www.mingw.org/ ?

No, I used for 32bit MinGW that is "i686-4.9.1-release-posix-dwarf-rt_v3-rev2.7z" downloaded from http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.1/threads-posix/dwarf/ .

And there is a additional information.
My trouble is fixed by Qt5.4.0, too.
https://bugreports.qt-project.org/browse/QTBUG-41472

@geraldstanje
Copy link
Author

just wondering why MinGW 4.9.1 is not in Minimalist GNU for Windows?!?

@Chironian
Copy link

I do not know it.
However, as for the release of Minimalist GNU for Windows, 4.8.1 of 2013 is the last.

@yxxyun
Copy link

yxxyun commented Jan 7, 2015

I have the same problem. test on QT5.4 MINGW 4.9.1 and QT 5.3.2 mingw 4.8.2 , windows 2003,
go 1.3~1.4

@adrianojn
Copy link

The patch https://github.com/noliar/qml/commit/352842b73ada0fc32d94cf91e75541e590675f82 solves "signal arrived during cgo execution" (Go 1.4, Qt 5.4, MinGW 4.9.1, Windows 7 32-bit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants