Application runs in Qt Creator, but not as an executable (Take 2)



  • I can run a Qt 5.8 app on my mac via Qt Creator. However, when I attempt to run the app outside of Qt (either via Terminal or by double clicking the executable in the build directory), the application crashes with the an EXC_BAD_ACCESS (SIGSEGV) exception.

    From a post entitled "Application runs in Qt Creator, but not as an executable" (https://forum.qt.io/topic/15118/application-runs-in-qt-creator-but-not-as-an-executable/2), I learned that my command line PATH variables should be set to the same as the environment utilized by Qt Creator (Project-> Build and Run -> Run Environment).

    However, my Qt Creator Run Environment is set to "Clean Environment". Thus, I am not aware of any PATH variables to set.

    Any thoughts as to wha I am doing wrong?

    Hoyt


  • Lifetime Qt Champion

    Hi,

    What does the stack trace tells you about this crash ?



  • The first portion of the listing follows:

    A link to the full listing is: https://spaces.hightail.com/receive/FLN36

    Process: eTouch [23407]
    Path: /Users/USER/Documents/*/eTouch.app/Contents/MacOS/eTouch
    Identifier: hoytf@mac.com.eTouch
    Version: 0
    Code Type: X86-64 (Native)
    Parent Process: ??? [1]
    Responsible: eTouch [23407]
    User ID: 501

    Date/Time: 2017-03-25 15:39:25.683 -0600
    OS Version: Mac OS X 10.11.6 (15G1217)
    Report Version: 11
    Anonymous UUID: 70FEE503-BAD9-069B-E24F-0C3982F7AD9F

    Time Awake Since Boot: 410000 seconds

    System Integrity Protection: enabled

    Crashed Thread: 0 Dispatch queue: com.apple.main-thread

    Exception Type: EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes: KERN_PROTECTION_FAILURE at 0x00007fff56efcf88
    Exception Note: EXC_CORPSE_NOTIFY

    VM Regions Near 0x7fff56efcf88:
    MALLOC_TINY 00007f7fe5000000-00007f7fe7800000 [ 40.0M] rw-/rwx SM=PRV
    --> STACK GUARD 00007fff536fd000-00007fff56efd000 [ 56.0M] ---/rwx SM=NUL stack guard for thread 0
    Stack 00007fff56efd000-00007fff576fd000 [ 8192K] rw-/rwx SM=PRV thread 0

    Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
    0 libsystem_malloc.dylib 0x00007fff9ac1364c szone_malloc_should_clear + 107
    1 libsystem_malloc.dylib 0x00007fff9ac135a1 malloc_zone_malloc + 71
    2 libsystem_malloc.dylib 0x00007fff9ac120cc malloc + 42
    3 org.qt-project.QtCore 0x000000013b3080d1 QArrayData::allocate(unsigned long, unsigned long, unsigned long, QFlagsQArrayData::AllocationOption) + 129
    4 org.qt-project.QtCore 0x000000013b30c383 QByteArray::fromRawData(char const*, int) + 51
    5 org.qt-project.QtCore 0x000000013b4ce6bd QMetaObjectPrivate::decodeMethodSignature(char const*, QVarLengthArray<QArgumentType, 10>&) + 493
    6 org.qt-project.QtCore 0x000000013b4f444d QObject::connect(QObject const*, char const*, QObject const*, char const*, Qt::ConnectionType) + 221
    7 org.qt-project.QtCore 0x000000013b4174f9 QTextStream::QTextStream(QIODevice*) + 121
    8 hoytf@mac.com.eTouch 0x0000000108516e3d myMessageOutput(QtMsgType, QMessageLogContext const&, QString const&) + 237
    9 org.qt-project.QtCore 0x000000013b2f85bd qt_message_output(QtMsgType, QMessageLogContext const&, QString const&) + 13
    10 org.qt-project.QtCore 0x000000013b3edbd0 QDebug::~QDebug() + 96
    11 org.qt-project.QtCore 0x000000013b408456 checkWarnMessage(QIODevice const*, char const*, char const*) + 1542
    12 org.qt-project.QtCore 0x000000013b40a255 QIODevice::write(char const*, long long) + 293
    13 org.qt-project.QtCore 0x000000013b416418 QTextStreamPrivate::flushWriteBuffer() + 248
    14 org.qt-project.QtCore 0x000000013b4179d0 QTextStream::~QTextStream() + 48
    15 hoytf@mac.com.eTouch 0x0000000108516e6f myMessageOutput(QtMsgType, QMessageLogContext const&, QString const&) + 287
    16 org.qt-project.QtCore 0x000000013b2f85bd qt_message_output(QtMsgType, QMessageLogContext const&, QString const&) + 13
    17 org.qt-project.QtCore 0x000000013b3edbd0 QDebug::~QDebug() + 96
    18 org.qt-project.QtCore 0x000000013b408456 checkWarnMessage(QIODevice const*, char const*, char const*) + 1542
    19 org.qt-project.QtCore 0x000000013b40a255 QIODevice::write(char const*, long long) + 293
    20 org.qt-project.QtCore 0x000000013b416418 QTextStreamPrivate::flushWriteBuffer() + 248
    21 org.qt-project.QtCore 0x000000013b4179d0 QTextStream::~QTextStream() + 48
    22 hoytf@mac.com.eTouch 0x0000000108516e6f myMessageOutput(QtMsgType, QMessageLogContext const&, QString const&) + 287
    23 org.qt-project.QtCore 0x000000013b2f85bd qt_message_output(QtMsgType, QMessageLogContext const&, QString const&) + 13
    24 org.qt-project.QtCore 0x000000013b3edbd0 QDebug::~QDebug() + 96
    25 org.qt-project.QtCore 0x000000013b408456 checkWarnMessage(QIODevice const*, char const*, char const*) + 1542
    26 org.qt-project.QtCore 0x000000013b40a255 QIODevice::write(char const*, long long) + 293
    27 org.qt-project.QtCore 0x000000013b416418 QTextStreamPrivate::flushWriteBuffer() + 248
    28 org.qt-project.QtCore 0x000000013b4179d0 QTextStream::~QTextStream() + 48
    29 hoytf@mac.com.eTouch 0x0000000108516e6f myMessageOutput(QtMsgType, QMessageLogContext const&, QString const&) + 287
    30 org.qt-project.QtCore 0x000000013b2f85bd qt_message_output(QtMsgType, QMessageLogContext const&, QString const&) + 13
    31 org.qt-project.QtCore 0x000000013b3edbd0 QDebug::~QDebug() + 96
    32 org.qt-project.QtCore 0x000000013b408456 checkWarnMessage(QIODevice const*, char const*, char const*) + 1542
    33 org.qt-project.QtCore 0x000000013b40a255 QIODevice::write(char const*, long long) + 293
    34 org.qt-project.QtCore 0x000000013b416418 QTextStreamPrivate::flushWriteBuffer() + 248
    35 org.qt-project.QtCore 0x000000013b4179d0 QTextStream::~QTextStream() + 48
    36 hoytf@mac.com.eTouch 0x0000000108516e6f myMessageOutput(QtMsgType, QMessageLogContext const&, QString const&) + 287


  • Lifetime Qt Champion

    Can you show the content of the myMessageOutput function ?



  • void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
    {
        QFile file(workingDirectory + "/Output/eTouch_Output.txt");
    
        if (secondTime == false)
        {
            file.open(QIODevice::WriteOnly | QIODevice::Truncate);
            secondTime = true;
        }
        else
        {
          file.open(QIODevice::WriteOnly | QIODevice::Append);
        }
    
        QTextStream out(&file);
        out << msg << "\n";
        file.close();
    }
    
    

  • Lifetime Qt Champion

    One thing: you don't check that the opening was successful.



  • sGaist.

    Thank you very much. You solved my issue. Thanks again.

    Hoyt


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.