Results 1 to 4 of 4

Thread: Qwt 6.3.0 app calling Qwt 6.3.0 craches

  1. #1
    Join Date
    Jan 2020
    Posts
    53
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Qwt 6.3.0 app calling Qwt 6.3.0 craches

    I have compiled Qwt 6.3.0 and see that the headers and the libs have been placed in
    /usr/local/qwt-6.3.0/include/
    and
    /usr/local/qwt-6.3.0/lib/
    respectively.

    I have build a Qt 6.7.0 app. using the following CMakeLists file:
    set(QWT_INCLUDE_DIR "/usr/local/qwt-6.3.0/include")
    set(QWT_LIBRARY "/usr/local/qwt-6.3.0/lib/libqwt.so")
    set(qwt_libraries ${QWT_LIBRARY}})
    set(test_SRC
    src/main.cpp
    src/test.cpp
    src/Plot.cpp
    )
    add_executable(test ${test_SRC})
    target_link_libraries(test Qt6::Widgets ${QWT_LIBRARY})

    Compiling the program and running it in the debugegr it craches with the error message:
    QWidget: Must construct a QApplication before a QWidget
    *** Program received signal SIGABRT (Aborted) ***

    In main I have
    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    test w;
    w.show();

    return app.exec();
    }
    which I think is correct.

    In MainWindow (i,e, test):

    test::test(QWidget *parent) :
    QMainWindow(parent),
    m_ui(new Ui::test)
    {
    qDebug() << "test::test 0";
    qDebug() << qApp;

    qDebug() << "test::test 1";
    m_ui->setupUi(this);
    qDebug() << "test::test 2";

    m_plot = new Plot(this);
    qDebug() << "test::test 3";

    Starting the debugger yields:
    test::test 0
    QApplication(0x7ffde3f14770)
    test::test 1
    test::test 2
    QWidget: Must construct a QApplication before a QWidget
    *** Program received signal SIGABRT (Aborted) ***

    test::test 3 is never printed out, so it seems the crash happens in the Plot constructor:
    Plot::Plot(QWidget *parent)
    : QwtPlot( parent )
    {
    qDebug() << "Plot::Plot 1";

    Again, Plot::Plot 1 is not printed out.
    Can it be that Qt 6.7.0 and Qwt 6.3.0 are incompatible?

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,318
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt 6.3.0 app calling Qwt 6.3.0 craches

    The warning is coming from the constructor of QWidget - what is a base class of QwtPlot - not from Qwt code.
    For some reason the qApp pointer is broken - at least this is the check, that leads to the message in QWidgetPrivate::QWidgetPrivate ( see qwidget.cpp ).

    HTH,
    Uwe

  3. #3
    Join Date
    Jan 2020
    Posts
    53
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Qwt 6.3.0 app calling Qwt 6.3.0 craches

    Yes, but just before instantiating qwt the qApp pointer appears to be OK:
    qDebug() << qApp; // Check
    QApplication(0x7ffde3f14770) // Prints out

    So it is definitely Qwt that's messing up things.

    At the top of the autogenerated README file for my test app I have this:

    CMake Qt5 GUI Template
    ----------------------

    You need Qt5 and CMake 2.8.11 or higher

    Can it be that there somehow is a Qt5-Qt6 mix-up? Kubuntu 24.04 use Plasma 5.27.11, which use Qt 5.15.13.

    But the contents of the file "Qt5Qwt6.pc", under /usr/local/qwt-6.3.0/lib/pkgconfig, reads:

    prefix=/usr
    exec_prefix=${prefix}
    libdir=${prefix}/local/qwt-6.3.0/lib
    includedir=${prefix}/local/qwt-6.3.0/include

    Name: Qwt6
    Description: Qt Widgets for Technical Applications
    Version: 6.3.0
    Libs: -L${libdir} -lqwt
    Cflags: -I${includedir}
    Requires: Qt5Widgets Qt5Concurrent Qt5PrintSupport Qt5OpenGL

    The way I interpret this is that "Qt5Widgets" refers to Qt5 used by Plasma. So as far as I can tell everything seems right. But my app craches as soon as I instantiates Qwt...

    It is pointed out here (
    https://stackoverflow.com/questions/...e-a-qwidg?rq=3) that using different compiler versions can case trubble, but I built Qt 6.7 and Qwt 6.3.0 with the same compiler (gcc 13.2.0), so it cannot be that.

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,318
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt 6.3.0 app calling Qwt 6.3.0 craches

    Maybe using ldd to find out what libraries/dependencies your application has ?

    HTH,
    Uwe

Similar Threads

  1. Qt Creator craches when running application on Windows 10
    By romainb78 in forum Qt Programming
    Replies: 3
    Last Post: 9th January 2016, 15:31
  2. Calling GUI functions from a DLL
    By inktomi in forum Qt Programming
    Replies: 0
    Last Post: 19th July 2010, 13:50
  3. Calling COM object from QT
    By mrityunjay in forum Qt Programming
    Replies: 0
    Last Post: 27th October 2009, 06:25
  4. Calling paintEvent when I want to
    By di_zou in forum Newbie
    Replies: 3
    Last Post: 14th October 2009, 11:29
  5. Calling QApplication from a Non-QT app?
    By hickscorp in forum Qt Programming
    Replies: 2
    Last Post: 10th April 2007, 23:00

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.