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. Application crash with TERMINATED
Forum Updated to NodeBB v4.3 + New Features

Application crash with TERMINATED

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 609 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.
  • E Offline
    E Offline
    Esley
    wrote on last edited by Esley
    #1

    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
    JonBJ 1 Reply Last reply
    0
    • E Esley

      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
      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

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

      E 1 Reply Last reply
      0
      • JonBJ JonB

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

        E Offline
        E Offline
        Esley
        wrote on last edited by
        #3

        @JonB in Qt Creator for example, running normal or debugging, I get only this in application console:

        12:00:00 Starting myapp...
        12:00:00 myapp crashed.
        

        Nothing more to help me is printed in console

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Anonymous_Banned275
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • E Offline
            E Offline
            Esley
            wrote on last edited by
            #5

            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
            
            JonBJ 1 Reply Last reply
            0
            • E Esley

              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
              
              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #6

              @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 some QApplication first.

              1 Reply Last reply
              0
              • A.A.SEZENA Offline
                A.A.SEZENA Offline
                A.A.SEZEN
                wrote on last edited by
                #7

                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.

                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