Application crash with TERMINATED
-
Hello guys,
I have one application made in QT, and sometimes when I start it, occurr an inexpected TERMINATED error.
But If I retry sometimes, the application open normally.ebonomo@ICCSW-044681NB /usr/local/app/bin$ ./myapp Terminado ebonomo@ICCSW-044681NB /usr/local/app/bin$ ./myapp Terminado ebonomo@ICCSW-044681NB /usr/local/app/bin$ ./myapp "Iniciando ... .....
I created a lib folder in app/lib with all libs detected in lddtree. I changed too in .bashrc to set LDLIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/app/lib/
But I can't get why this error. Could you help me? How can I get the cause? Is there any command to check it?
I already tried remove all in main method keeping only a debug message, and the error occurred yet.
I don't know more what can I do. :(
My environment is:
- Ubuntu 20.04
- Qt 5.15.2
- Qt Creator 7.0.1
- Based on Qt 6.2.3 (GCC 10.3.1 20210422 (Red Hat 10.3.1-1), 64 bit)
- Built on Apr 26 2022 01:18:11
- From revision da16d778d5
-
Hello guys,
I have one application made in QT, and sometimes when I start it, occurr an inexpected TERMINATED error.
But If I retry sometimes, the application open normally.ebonomo@ICCSW-044681NB /usr/local/app/bin$ ./myapp Terminado ebonomo@ICCSW-044681NB /usr/local/app/bin$ ./myapp Terminado ebonomo@ICCSW-044681NB /usr/local/app/bin$ ./myapp "Iniciando ... .....
I created a lib folder in app/lib with all libs detected in lddtree. I changed too in .bashrc to set LDLIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/app/lib/
But I can't get why this error. Could you help me? How can I get the cause? Is there any command to check it?
I already tried remove all in main method keeping only a debug message, and the error occurred yet.
I don't know more what can I do. :(
My environment is:
- Ubuntu 20.04
- Qt 5.15.2
- Qt Creator 7.0.1
- Based on Qt 6.2.3 (GCC 10.3.1 20210422 (Red Hat 10.3.1-1), 64 bit)
- Built on Apr 26 2022 01:18:11
- From revision da16d778d5
-
@Esley
If you claim it intermittent then it cannot be something like a library path that is at issue. I have no idea what your cause may be. Run it in a debugger and see if you get any more information when it does terminate. -
Assuming it is intermittent - you still have an option to set breakpoints until you find where it no longer runs correctly.
Another way which sometime works when GDB is not cooperating -setup temporary "return" or even "exit" to find the bug. -
I can reproduce:
int main(int argc, char *argv[]) { qFatal("Starting application"); }
My .pro is it:
#------------------------------------------------- # # Project created by QtCreator 2020-09-24T10:15:43 # #------------------------------------------------- QT += core gui network svg QT += multimedia QT += multimediawidgets QT += 3drender QT += printsupport CONFIG += ccache use_gold_linker precompile_header # Improve Build Speed PRECOMPILED_HEADER = precompiled_header.h greaterThan(QT_MAJOR_VERSION, 4): QT += widgets quick # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = $$PWD/ui/imports TARGET = myapp TEMPLATE = app INCLUDEPATH += $$PWD/libs INCLUDEPATH += $$PWD/libs/qtmqtt INCLUDEPATH += /usr/include/opencv4 INCLUDEPATH += $$PWD/imagerender/src INCLUDEPATH += $$PWD/libs/fingerprint/Futronic/header #Include static lib QT MQTT equals(QT_VERSION, "5.15.2") { #message("Loading lib libQt5Mqtt for 5.15.2") LIBS += -L$$PWD/libs/qtmqtt/5.15.2 -lQt5Mqtt QMAKE_LFLAGS += -Wl,--rpath=$$PWD/libs/qtmqtt/5.15.2 } equals(QT_VERSION, "5.15.1") { #message("Loading lib libQt5Mqtt for 5.15.1") LIBS += -L$$PWD/libs/qtmqtt/5.15.1 -lQt5Mqtt QMAKE_LFLAGS += -Wl,--rpath=$$PWD/libs/qtmqtt/5.15.1 } LIBS += -L$$PWD/libs/fingerprint/Futronic -lScanAPI QMAKE_LFLAGS += -Wl,--rpath=$$PWD/libs/fingerprint/Futronic # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 LIBS += -lopencv_core LIBS += -lopencv_highgui LIBS += -lopencv_imgproc LIBS += -lopencv_features2d LIBS += -lopencv_calib3d LIBS += -lopencv_videoio LIBS += -lopencv_imgcodecs LIBS += -lrt SOURCES += \ main.cpp # a lot of .cpp here HEADERS += \ constants.h # a lot of .h here FORMS += DISTFILES += \ settings.ini RESOURCES += \ resources.qrc \ images/logos/logo.png TRANSLATIONS += i18n/en.ts \ i18n/es.ts \ i18n/pt.ts # From here https://stackoverflow.com/a/36438618 copydata.commands = $(COPY_DIR) $$PWD/settings.ini $$OUT_PWD first.depends = $(first) copydata export(first.depends) export(copydata.commands) QMAKE_CXXFLAGS += -Wno-unknown-pragmas # Ignore pragma region warnings QMAKE_EXTRA_TARGETS += first copydata
-
I can reproduce:
int main(int argc, char *argv[]) { qFatal("Starting application"); }
My .pro is it:
#------------------------------------------------- # # Project created by QtCreator 2020-09-24T10:15:43 # #------------------------------------------------- QT += core gui network svg QT += multimedia QT += multimediawidgets QT += 3drender QT += printsupport CONFIG += ccache use_gold_linker precompile_header # Improve Build Speed PRECOMPILED_HEADER = precompiled_header.h greaterThan(QT_MAJOR_VERSION, 4): QT += widgets quick # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = $$PWD/ui/imports TARGET = myapp TEMPLATE = app INCLUDEPATH += $$PWD/libs INCLUDEPATH += $$PWD/libs/qtmqtt INCLUDEPATH += /usr/include/opencv4 INCLUDEPATH += $$PWD/imagerender/src INCLUDEPATH += $$PWD/libs/fingerprint/Futronic/header #Include static lib QT MQTT equals(QT_VERSION, "5.15.2") { #message("Loading lib libQt5Mqtt for 5.15.2") LIBS += -L$$PWD/libs/qtmqtt/5.15.2 -lQt5Mqtt QMAKE_LFLAGS += -Wl,--rpath=$$PWD/libs/qtmqtt/5.15.2 } equals(QT_VERSION, "5.15.1") { #message("Loading lib libQt5Mqtt for 5.15.1") LIBS += -L$$PWD/libs/qtmqtt/5.15.1 -lQt5Mqtt QMAKE_LFLAGS += -Wl,--rpath=$$PWD/libs/qtmqtt/5.15.1 } LIBS += -L$$PWD/libs/fingerprint/Futronic -lScanAPI QMAKE_LFLAGS += -Wl,--rpath=$$PWD/libs/fingerprint/Futronic # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 LIBS += -lopencv_core LIBS += -lopencv_highgui LIBS += -lopencv_imgproc LIBS += -lopencv_features2d LIBS += -lopencv_calib3d LIBS += -lopencv_videoio LIBS += -lopencv_imgcodecs LIBS += -lrt SOURCES += \ main.cpp # a lot of .cpp here HEADERS += \ constants.h # a lot of .h here FORMS += DISTFILES += \ settings.ini RESOURCES += \ resources.qrc \ images/logos/logo.png TRANSLATIONS += i18n/en.ts \ i18n/es.ts \ i18n/pt.ts # From here https://stackoverflow.com/a/36438618 copydata.commands = $(COPY_DIR) $$PWD/settings.ini $$OUT_PWD first.depends = $(first) copydata export(first.depends) export(copydata.commands) QMAKE_CXXFLAGS += -Wno-unknown-pragmas # Ignore pragma region warnings QMAKE_EXTRA_TARGETS += first copydata
@Esley said in Application crash with TERMINATED:
qFatal("Starting application");
Umm, what do you expect this to do?? It seems to be behaving correctly....
As a separate issue, I am not 100% sure that can/are supposed to use
qFatal()
without having created someQApplication
first. -
In your main window's creation lines, also qInfo() << ""; Proceed with. It will guide you to which line it progresses. For example, there may be definitions of your widgets that conflict with an operation such as restoreGometry (again for example, QDockWidget). Thus, the window is loaded when compatible, otherwise it crashes. In any case, as our other friends emphasized, qInfo(), qDebug() etc. It will be useful for you to progress with the flow of information.