Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QApplication constructor cause segmentation fault
Forum Updated to NodeBB v4.3 + New Features

QApplication constructor cause segmentation fault

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 5 Posters 2.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • alexburA Offline
    alexburA Offline
    alexbur
    wrote on last edited by alexbur
    #1

    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

    kshegunovK 1 Reply Last reply
    0
    • fcarneyF Offline
      fcarneyF Offline
      fcarney
      wrote on last edited by
      #2

      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.

      C++ is a perfectly valid school of magic.

      alexburA 1 Reply Last reply
      1
      • alexburA Offline
        alexburA Offline
        alexbur
        wrote on last edited by
        #3

        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?

        aha_1980A 1 Reply Last reply
        0
        • fcarneyF fcarney

          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.

          alexburA Offline
          alexburA Offline
          alexbur
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • alexburA alexbur

            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?

            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @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 has to stay free or it will die.

            alexburA 1 Reply Last reply
            1
            • alexburA alexbur

              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

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by
              #6

              @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.

              Read and abide by the Qt Code of Conduct

              alexburA 1 Reply Last reply
              2
              • alexburA Offline
                alexburA Offline
                alexbur
                wrote on last edited by kshegunov
                #7

                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();
                }
                
                aha_1980A alexburA 2 Replies Last reply
                1
                • aha_1980A aha_1980

                  @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?

                  alexburA Offline
                  alexburA Offline
                  alexbur
                  wrote on last edited by
                  #8

                  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.
                  
                  .
                  
                  1 Reply Last reply
                  0
                  • alexburA alexbur

                    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();
                    }
                    
                    aha_1980A Offline
                    aha_1980A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @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

                    Qt has to stay free or it will die.

                    1 Reply Last reply
                    2
                    • kshegunovK kshegunov

                      @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.

                      alexburA Offline
                      alexburA Offline
                      alexbur
                      wrote on last edited by alexbur
                      #10

                      @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)

                      
                      
                      1 Reply Last reply
                      0
                      • Christian EhrlicherC Offline
                        Christian EhrlicherC Offline
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

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

                        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                        Visit the Qt Academy at https://academy.qt.io/catalog

                        alexburA 1 Reply Last reply
                        2
                        • Christian EhrlicherC Christian Ehrlicher

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

                          alexburA Offline
                          alexburA Offline
                          alexbur
                          wrote on last edited by
                          #12

                          @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.

                          aha_1980A 1 Reply Last reply
                          0
                          • alexburA alexbur

                            @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.

                            aha_1980A Offline
                            aha_1980A Offline
                            aha_1980
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            @alexbur

                            https://doc.qt.io/qtcreator/creator-debug-mode.html#viewing-call-stack-trace

                            Qt has to stay free or it will die.

                            1 Reply Last reply
                            1
                            • alexburA alexbur

                              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();
                              }
                              
                              alexburA Offline
                              alexburA Offline
                              alexbur
                              wrote on last edited by
                              #14

                              @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?

                              1 Reply Last reply
                              0
                              • alexburA Offline
                                alexburA Offline
                                alexbur
                                wrote on last edited by
                                #15

                                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...

                                aha_1980A 1 Reply Last reply
                                1
                                • alexburA alexbur

                                  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...

                                  aha_1980A Offline
                                  aha_1980A Offline
                                  aha_1980
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

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

                                  Qt has to stay free or it will die.

                                  1 Reply Last reply
                                  0

                                  • Login

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Users
                                  • Groups
                                  • Search
                                  • Get Qt Extensions
                                  • Unsolved