Static release app crashes, all others are fine
-
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; }
-
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
-
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