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. Static release app crashes, all others are fine
QtWS25 Last Chance

Static release app crashes, all others are fine

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 2.1k Views
  • 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.
  • N Offline
    N Offline
    nostar
    wrote on last edited by
    #1

    I am using Qt 5.7 / Creator 4.1 on Windows with Mingw. I built a static build of Qt from source per these instructions:

    http://dimitris.apeiro.gr/2015/06/24/build-a-static-qt5-for-windows-by-compiling/

    The only difference is I downloaded the source (qt-everywhere-opensource-src-5.7.0.zip) manually instead of downloading it via the Qt Maintenance Tool. I added it as a new kit.

    Any app I build as 'static release' crashes upon signal emission from widgets. Any test app I try works fine when built 'static debug', 'dynamic release', or 'dynamic debug'.

    For example, a new bare Qt Widgets Application with only a MainWindow will run as static release but will crash if I move the empty toolbar. If I add a pushbutton widget, then it will crash if I click the button. If I add a LineEdit, then it will crash when I hover over the edit box. If I add a TextEdit, it crashes on launch. In all of these cases, it still crashes even if I connect the signals to a slot. In the case of the TextEdit, I connected every signal, including inherited signals, to a slot but it still crashes:

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <iostream>
    
    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
        connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(nothing()));
        
        connect(ui->textEdit, SIGNAL(selectionChanged()), this, SLOT(nothing()));
        connect(ui->textEdit, SIGNAL(textChanged()), this, SLOT(nothing()));
        connect(ui->textEdit, SIGNAL(cursorPositionChanged()), this, SLOT(nothing()));
        connect(ui->textEdit, SIGNAL(copyAvailable(bool)), this, SLOT(nothing()));
        connect(ui->textEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(nothing()));
        connect(ui->textEdit, SIGNAL(redoAvailable(bool)), this, SLOT(nothing()));
        connect(ui->textEdit, SIGNAL(undoAvailable(bool)), this, SLOT(nothing()));
        connect(ui->textEdit, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(nothing()));
        connect(ui->textEdit, SIGNAL(windowIconChanged(QIcon)), this, SLOT(nothing()));
        connect(ui->textEdit, SIGNAL(windowTitleChanged(QString)), this, SLOT(nothing()));
        connect(ui->textEdit, SIGNAL(destroyed(QObject*)), this, SLOT(nothing()));
        connect(ui->textEdit, SIGNAL(objectNameChanged(QString)), this, SLOT(nothing()));
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    MainWindow::nothing()
    {
        std::cerr << "Nothing to do here" << std::endl;
    }
    
    
    kshegunovK 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      Random luck strikes and I actually used the same tut to create
      a static kit on windows (10).

      I tried your sample but it dont crash at all.

      So maybe your build have some issue. Not sure what it could be.

      You could try run my compiled exe and see if it does crash on your system.
      (note. i dont normally advise running other unknown exe files but in this case it's 100% safe)

      https://www.dropbox.com/s/l9cf3ubstizas22/statictest.zip?dl=0


      1 Reply Last reply
      1
      • N nostar

        I am using Qt 5.7 / Creator 4.1 on Windows with Mingw. I built a static build of Qt from source per these instructions:

        http://dimitris.apeiro.gr/2015/06/24/build-a-static-qt5-for-windows-by-compiling/

        The only difference is I downloaded the source (qt-everywhere-opensource-src-5.7.0.zip) manually instead of downloading it via the Qt Maintenance Tool. I added it as a new kit.

        Any app I build as 'static release' crashes upon signal emission from widgets. Any test app I try works fine when built 'static debug', 'dynamic release', or 'dynamic debug'.

        For example, a new bare Qt Widgets Application with only a MainWindow will run as static release but will crash if I move the empty toolbar. If I add a pushbutton widget, then it will crash if I click the button. If I add a LineEdit, then it will crash when I hover over the edit box. If I add a TextEdit, it crashes on launch. In all of these cases, it still crashes even if I connect the signals to a slot. In the case of the TextEdit, I connected every signal, including inherited signals, to a slot but it still crashes:

        #include "mainwindow.h"
        #include "ui_mainwindow.h"
        #include <iostream>
        
        MainWindow::MainWindow(QWidget *parent) :
            QMainWindow(parent),
            ui(new Ui::MainWindow)
        {
            ui->setupUi(this);
            connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(nothing()));
            
            connect(ui->textEdit, SIGNAL(selectionChanged()), this, SLOT(nothing()));
            connect(ui->textEdit, SIGNAL(textChanged()), this, SLOT(nothing()));
            connect(ui->textEdit, SIGNAL(cursorPositionChanged()), this, SLOT(nothing()));
            connect(ui->textEdit, SIGNAL(copyAvailable(bool)), this, SLOT(nothing()));
            connect(ui->textEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(nothing()));
            connect(ui->textEdit, SIGNAL(redoAvailable(bool)), this, SLOT(nothing()));
            connect(ui->textEdit, SIGNAL(undoAvailable(bool)), this, SLOT(nothing()));
            connect(ui->textEdit, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(nothing()));
            connect(ui->textEdit, SIGNAL(windowIconChanged(QIcon)), this, SLOT(nothing()));
            connect(ui->textEdit, SIGNAL(windowTitleChanged(QString)), this, SLOT(nothing()));
            connect(ui->textEdit, SIGNAL(destroyed(QObject*)), this, SLOT(nothing()));
            connect(ui->textEdit, SIGNAL(objectNameChanged(QString)), this, SLOT(nothing()));
        }
        
        MainWindow::~MainWindow()
        {
            delete ui;
        }
        
        MainWindow::nothing()
        {
            std::cerr << "Nothing to do here" << std::endl;
        }
        
        
        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by
        #3

        Hi,
        Try building the application as release with debug info: -O2 -g and attach gdb to the process before doing anything with the GUI. Hopefully this will allow you to extract a meaningful stack trace.

        Kind regards.

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        0
        • N Offline
          N Offline
          nostar
          wrote on last edited by
          #4

          I deleted my entire source tree and source zip file and started all over from scratch. This time everything works, and I can create static builds of both release and debug for Windows. Yay!

          mrjjM 1 Reply Last reply
          1
          • N nostar

            I deleted my entire source tree and source zip file and started all over from scratch. This time everything works, and I can create static builds of both release and debug for Windows. Yay!

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @nostar
            Thank you for reporting back.
            Can i as how big your static version is?
            (whole folder)

            1 Reply Last reply
            0
            • N Offline
              N Offline
              nostar
              wrote on last edited by
              #6

              The entire Qt directory (installed version, Qt Creator, gcc, static build, etc) is 7.7GB

              Qt/Qt5_static is 3.5GB

               MINGW64 /d
              $ du -h --max-depth=1 Qt
              3.0G    Qt/5.7
              4.0K    Qt/dist
              448M    Qt/Docs
              92M     Qt/Examples
              184K    Qt/Licenses
              3.5G    Qt/Qt5_static
              662M    Qt/Tools
              6.3M    Qt/vcredist
              7.7G    Qt
              
              
              mrjjM 1 Reply Last reply
              0
              • N nostar

                The entire Qt directory (installed version, Qt Creator, gcc, static build, etc) is 7.7GB

                Qt/Qt5_static is 3.5GB

                 MINGW64 /d
                $ du -h --max-depth=1 Qt
                3.0G    Qt/5.7
                4.0K    Qt/dist
                448M    Qt/Docs
                92M     Qt/Examples
                184K    Qt/Licenses
                3.5G    Qt/Qt5_static
                662M    Qt/Tools
                6.3M    Qt/vcredist
                7.7G    Qt
                
                
                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @nostar
                Thx. Just checking. Mine static qt folder was ca. the same
                and i was wondering if i made it fat somehow ;)
                but seems pretty normal size. thank you.

                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