I have one application made in QT, and sometimes when I start it, occurre 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 LD_LIBRARY_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
OBS: I can reproduce the error with this code:
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