Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

futex Error while building on linux for QT Application



  • I am trying to test a close splash screen example. But facing some difficulties. I have attached all my relevant files below:

    Following in my pro file:

    QT       += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    CONFIG += c++11
    
    # The following define makes your compiler emit warnings if you use
    # any Qt feature that has been marked 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 it uses 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
    
    SOURCES += \
        main.cpp \
        mainwindow.cpp
    
    HEADERS += \
        mainwindow.h
    
    FORMS += \
        mainwindow.ui
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
    RESOURCES += \
        test.qrc
    

    Here is my main.cpp

        QApplication a(argc, argv);
        MainWindow w;
        QPixmap pixMap(":/images/Splash.bmp");
        QSplashScreen* splash = new QSplashScreen(pixMap,Qt::WindowStaysOnTopHint);
        splash->show();
        QTime waitTime = QTime::currentTime().addSecs(2);
        while (QTime::currentTime() < waitTime)
            QCoreApplication::processEvents();
        splash->hide();
        w.show();
        return a.exec();
    

    Here is my mainwindow.cpp :

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    
    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    

    The problem is my application crashes when I try to show splashscreen on line 12 in main.cpp. I get the error :

    The futex facility returned an unexpected error code.The futex facility returned an unexpected error code.The futex facility returned an unexpected error code.The futex facility returned an unexpected error code.The futex facility returned an unexpected error code.The futex facility returned an unexpected error code.The futex facility returned an unexpected error code.The futex facility returned an unexpected error code.


  • Qt Champions 2019

    @jineshmehta said in futex Error while building on linux for QT Application:

    while (QTime::currentTime() < waitTime)
    QCoreApplication::processEvents();

    This is not how it should be done!
    Remove the loop.
    Use a timer to hide the splash.



  • Even with this code it is crashing after show:

    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        MainWindow w;
        QPixmap pixMap(":/images/Splash.bmp");
        QSplashScreen* splash = new QSplashScreen(pixMap,Qt::WindowStaysOnTopHint);
        splash->show();
        splash->hide();
        w.show();
        return a.exec();
    }
    

  • Qt Champions 2019

    @jineshmehta Please use debugger to see where exactly it is crashing and to get stack trace.



  • @jsulm I got the stack error but its coming from another thread. Check the snap:

    0be64e65-5a37-4f62-bdf7-f21f25aa966e-image.png

    I think it is coming from UI call.


  • Qt Champions 2019

    @jineshmehta Please use debug build not release



  • @jsulm I am running the application in debug mode only. For the reference I have recorded all the steps here:
    https://streamable.com/76rwei


Log in to reply