QApplication constructor cause segmentation fault



  • Windows 10, mingw64 7.30, shipped with Qt 5.12.3 My application failed to start, on terminal it leaves no any messages, only in debugger it failed and arrow point s to QApplication call, after displaying: "segmentation fault"

    Any advice how to move on? UnFortunately,I'm already postdeadliner, any help appreciated



  • Have you changed your Run environment lately?
    Make sure your run environment (Projects->Run->Run Environment->Details) is set to Build Environment and not something like Clean Environment. I accidentally changed mine the other day and had seg faults on QApplication due to this.



  • https://wiki.qt.io/MinGW
    The binary packages were compiled mingw.org gcc 4.4 toolchain that is unfortunately not officially provided anymore.
    But 5.12.3 shipped with mingw7.30.
    could someone instruct me how to recompile QT binaries with proper mingw?



  • Thank you,fcarney for the hint. I tried it, it did not helped, unfortunately, It is something else.


  • Qt Champions 2018

    @alexbur

    But 5.12.3 shipped with mingw7.30.
    could someone instruct me how to recompile QT binaries with proper mingw?

    What do you mean? The official 5.12.3 release is compiled with MinGW 7.3.0. The installer contains the same compiler for you.

    Why do you want MinGW 4.4?


  • Qt Champions 2017

    @alexbur said in QApplication constructor cause segmentation fault:

    only in debugger it failed and arrow point s to QApplication call, after displaying: "segmentation fault"

    Stack trace and a code snippet please.



  • Thank you all for taking a look. Kchegunov,I'm linux guy,and can strace on linux, Please direct me on how I can strace on Windows? Please note, that on Fedora30 THE code works nicely and as expected, but Windows variant....
    Also, may some one explain me how I can attach png to my post? Main cpp code is below,per your request:

    #include "mainwindow.h"
    #include <QApplication>
    #include<QStringList>
    const  QStringList paths={"C:/ADLL_s"};
    int main(int argc, char *argv[]);
    ;
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);//SEGFAULT Is Here
    
        printf("*****************************************\n**WHATEVER INC.**\n***************************************\n");
    
         app.setLibraryPaths(paths);
         app.setWindowIcon(QIcon(":../icons/whatever.ico"));
         app.setOrganizationName("WHATEVER INC.");
         app.setApplicationName("nice application");
        MainWindow mwnd;
            mwnd.show();
    
        return app.exec();
    }
    


  • Thank you aha_1980.Please find below copy of Qt creator about dialog:

    Qt Creator 4.9.0
    Based on Qt 5.12.2 **(MSVC 2017, 32 bit)**
    
    Built on Apr 11 2019 21:21:37
    
    From revision 7885bc899f
    
    Copyright 2008-2019 The Qt Company Ltd. All rights reserved.
    
    .
    

  • Qt Champions 2018

    @alexbur

    Kchegunov,I'm linux guy,and can strace on linux, Please direct me on how I can strace on Windows?

    @kshegunov reqested a stack trace or backtrace, i.e. the callstack in the moment of crasing.

    Just run your prog in debugger and post the stacktrace after the crash.

    Your problem smells like incompatible Qt DLLs are somewhere in your PATH, woh many Qt versions have you installed?

    Also, make really sure every part of your prog is rebuild and no old artifacts are linked in.

    Regards



  • @kshegunov ```
    Locals
    app @0x7dfd70 QApplication
    [QGuiApplication] @0x7dfd70 QGuiApplication
    [d] @0x2ab92da0 QApplicationPrivate
    [parent] QObject
    [children] <0 items>
    [properties] <at least 10 items>
    [methods] <6 items>
    [extra]
    staticMetaObject @0x1d116080 QMetaObject
    argc 1 int
    argv <1 items> char **
    mwnd @0x7dfd30 MainWindow
    Inspector
    Expressions
    Return Value
    Tooltip

    strace:(obtained in msys2 terminal)```
    --- Process 8176 created
    --- Process 8176 loaded C:\Windows\System32\ntdll.dll at 00007ff9788d0000
    --- Process 8176 loaded C:\Windows\System32\kernel32.dll at 00007ff975e30000
    --- Process 8176 loaded C:\Windows\System32\KernelBase.dll at 00007ff974e70000
    --- Process 8176 thread 7960 created
    --- Process 8176 loaded C:\Windows\System32\advapi32.dll at 00007ff9781f0000
    --- Process 8176 thread 6296 created
    --- Process 8176 loaded C:\Windows\System32\msvcrt.dll at 00007ff977dd0000
    --- Process 8176 thread 14116 created
    --- Process 8176 loaded C:\Windows\System32\sechost.dll at 00007ff977d70000
    --- Process 8176 loaded C:\Windows\System32\rpcrt4.dll at 00007ff975ee0000
    --- Process 8176 loaded C:\Windows\System32\shell32.dll at 00007ff976930000
    --- Process 8176 loaded C:\Windows\System32\cfgmgr32.dll at 00007ff975d30000
    --- Process 8176 loaded C:\Windows\System32\ucrtbase.dll at 00007ff975c30000
    --- Process 8176 loaded C:\Windows\System32\SHCore.dll at 00007ff9787c0000
    --- Process 8176 loaded C:\Windows\System32\combase.dll at 00007ff976010000
    --- Process 8176 loaded C:\Windows\System\Qt5Widgetsd.dll at 0000000067c80000
    --- Process 8176 loaded C:\Windows\System32\gdi32.dll at 00007ff977fd0000
    --- Process 8176 loaded C:\Windows\System32\gdi32full.dll at 00007ff975130000
    --- Process 8176 loaded C:\Windows\System32\msvcp_win.dll at 00007ff9759c0000
    --- Process 8176 loaded C:\Windows\System32\user32.dll at 00007ff977e70000
    --- Process 8176 loaded C:\Windows\System32\win32u.dll at 00007ff974df0000
    --- Process 8176 loaded C:\Windows\System\Qt5Guid.dll at 0000000000fa0000
    --- Process 8176 unloaded DLL at 0000000000fa0000
    --- Process 8176 loaded C:\Windows\System\libgcc_s_seh-1.dll at 0000000061440000
    --- Process 8176 loaded C:\Windows\System32\dwmapi.dll at 00007ff971f80000
    --- Process 8176 loaded C:\Windows\System32\uxtheme.dll at 00007ff973610000
    --- Process 8176 loaded C:\Windows\System\libstdc++-6.dll at 0000000000fa0000
    --- Process 8176 unloaded DLL at 0000000000fa0000
    --- Process 8176 loaded C:\Windows\System32\bcryptprimitives.dll at 00007ff9750c0000
    --- Process 8176 loaded C:\Windows\System32\windows.storage.dll at 00007ff9752c0000
    --- Process 8176 loaded C:\Windows\System32\shlwapi.dll at 00007ff9768a0000
    --- Process 8176 loaded C:\Windows\System\Qt5Cored.dll at 0000000000fa0000
    --- Process 8176 unloaded DLL at 0000000000fa0000
    --- Process 8176 loaded C:\Windows\System\Qt5Guid.dll at 0000000000fa0000
    --- Process 8176 unloaded DLL at 0000000000fa0000
    --- Process 8176 loaded C:\Windows\System\libwinpthread-1.dll at 0000000064940000
    --- Process 8176 loaded C:\Windows\System32\kernel.appcore.dll at 00007ff974dd0000
    --- Process 8176 loaded C:\Windows\System\Qt5Cored.dll at 0000000000fa0000
    --- Process 8176 unloaded DLL at 0000000000fa0000
    --- Process 8176 loaded C:\Windows\System32\powrprof.dll at 00007ff974d40000
    --- Process 8176 loaded C:\Windows\System32\profapi.dll at 00007ff974d90000
    --- Process 8176 loaded C:\Windows\System\libstdc++-6.dll at 0000000000fa0000
    --- Process 8176 unloaded DLL at 0000000000fa0000
    --- Process 8176 loaded C:\Windows\System\Qt5Guid.dll at 0000000000fa0000
    --- Process 8176 loaded C:\Windows\System32\ole32.dll at 00007ff9780a0000
    --- Process 8176 loaded C:\Windows\System\libstdc++-6.dll at 0000000012c80000
    --- Process 8176 loaded C:\Windows\System\libstdc++-6.dll at 0000000012df0000
    --- Process 8176 loaded C:\Windows\System\Qt5Cored.dll at 000000001cfb0000
    --- Process 8176 loaded C:\Windows\System\Qt5Cored.dll at 0000000012f60000
    --- Process 8176 unloaded DLL at 0000000012f60000
    --- Process 8176 unloaded DLL at 0000000012df0000
    --- Process 8176 loaded C:\Windows\System32\mpr.dll at 00007ff964060000
    --- Process 8176 loaded C:\Windows\System32\netapi32.dll at 00007ff965730000
    --- Process 8176 loaded C:\Windows\System32\ws2_32.dll at 00007ff978030000
    --- Process 8176 loaded C:\Windows\System32\userenv.dll at 00007ff974c70000
    --- Process 8176 loaded C:\Windows\System32\version.dll at 00007ff9704d0000
    --- Process 8176 loaded C:\Windows\System32\winmm.dll at 00007ff972070000
    --- Process 8176 loaded C:\Windows\System32\winmmbase.dll at 00007ff972010000
    --- Process 8176 loaded C:\Windows\System32\winmmbase.dll at 0000000000140000
    --- Process 8176 loaded C:\Windows\System32\cryptbase.dll at 00007ff9747b0000
    --- Process 8176 unloaded DLL at 0000000000140000
    --- Process 8176 loaded C:\Windows\System32\winmmbase.dll at 0000000000140000
    --- Process 8176 unloaded DLL at 0000000000140000
    --- Process 8176 loaded C:\Windows\System32\netutils.dll at 00007ff974480000
    --- Process 8176 loaded C:\Windows\System32\srvcli.dll at 00007ff963350000
    --- Process 8176 loaded C:\Windows\System32\imm32.dll at 00007ff976900000
    --- Process 8176 thread 1192 exited with status 0xc0000602
    --- Process 8176 thread 7960 exited with status 0xc0000602
    --- Process 8176 thread 6296 exited with status 0xc0000602
    --- Process 8176 exited with status 0xc0000602
    note: Exception code: 0xc0000602 Fault offset(from googling inet)

    
    

  • Qt Champions 2018

    We need a StackTrace from the debugger, no strace output...



  • @Christian-Ehrlicher

    Christian, I published debugger output , please look through my posts, it starts with word Locals, Otherwise please provide me with step by step instructions on what is required
    Thanks,
    Alex.


  • Qt Champions 2018



  • @alexbur
    I were tryied to change compiler from mingw64 to msvc2017_x64. If I did all correctly, I accomplished that by "Manage kits"then I have same result, same spot:at QApplication, segfault. I'm new bee to Qt, so could omitted some important step.Is the process of selecting compiler environment with Manage kits described somewhere in doc-s?



  • Fellow Forumers,THANK YOU ALL FOR YOUR GREAT SUPPORT. I 'm back on MOVING train and have now a chance to catch the deadline How stupid I were, could you imagine? I just did not pay attention to the first line of strace output:"--- Process 8176 loaded C:\Windows\System32\ntdll.dll at 00007ff9788d0000" It took two days to connect together obvious things:System32/ntdll and MIngw64. thank you all again, now I'm drinking Amstel and prepare presentation for the next week review........ Great team work! :). So I reinstalled Qt5.13, paying attention to choosing 64/32 modules, reconfigure project, recompile and run to grab opener...


  • Qt Champions 2018

    @alexbur glad you solved it. So please mark this topic as SOLVED too. Thanks


Log in to reply