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. Qt Quick with cmake fails on Linux
Forum Updated to NodeBB v4.3 + New Features

Qt Quick with cmake fails on Linux

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 1.1k Views
  • 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.
  • M Offline
    M Offline
    michal.19937
    wrote on last edited by
    #1

    Hello,
    I have a problem - when I build and run a Qt Quick app on Linux Mint 22 no window appears and some Qt metadata is printed to the console. On Windows 11 the same code works though.
    The metadata:

    michal@Mint-VM:~/qt-test/build$ ./qt-test
    qt.core.plugin.factoryloader: checking directory path "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms" ...
    qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqvkkhrdisplay.so"
    qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqvkkhrdisplay.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "vkkhrdisplay"
            ]
        },
        "archlevel": 1,
        "className": "QVkKhrDisplayIntegrationPlugin",
        "debug": false,
        "version": 394240
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("vkkhrdisplay")
    qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqlinuxfb.so"
    qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqlinuxfb.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "linuxfb"
            ]
        },
        "archlevel": 1,
        "className": "QLinuxFbIntegrationPlugin",
        "debug": false,
        "version": 394240
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("linuxfb")
    qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqxcb.so"
    qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqxcb.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "xcb"
            ]
        },
        "archlevel": 1,
        "className": "QXcbIntegrationPlugin",
        "debug": false,
        "version": 394240
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("xcb")
    qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqeglfs.so"
    qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqeglfs.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "eglfs"
            ]
        },
        "archlevel": 1,
        "className": "QEglFSIntegrationPlugin",
        "debug": false,
        "version": 394240
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("eglfs")
    qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqvnc.so"
    qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqvnc.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "vnc"
            ]
        },
        "archlevel": 1,
        "className": "QVncIntegrationPlugin",
        "debug": false,
        "version": 394240
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("vnc")
    qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqoffscreen.so"
    qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqoffscreen.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "offscreen"
            ]
        },
        "archlevel": 1,
        "className": "QOffscreenIntegrationPlugin",
        "debug": false,
        "version": 394240
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("offscreen")
    qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqwayland-generic.so"
    qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqwayland-generic.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "wayland"
            ]
        },
        "archlevel": 1,
        "className": "QWaylandIntegrationPlugin",
        "debug": false,
        "version": 394240
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wayland")
    qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqminimal.so"
    qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqminimal.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimal"
            ]
        },
        "archlevel": 1,
        "className": "QMinimalIntegrationPlugin",
        "debug": false,
        "version": 394240
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimal")
    qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqwayland-egl.so"
    qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqwayland-egl.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "wayland-egl"
            ]
        },
        "archlevel": 1,
        "className": "QWaylandEglPlatformIntegrationPlugin",
        "debug": false,
        "version": 394240
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wayland-egl")
    qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqminimalegl.so"
    qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqminimalegl.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimalegl"
            ]
        },
        "archlevel": 1,
        "className": "QMinimalEglIntegrationPlugin",
        "debug": false,
        "version": 394240
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimalegl")
    qt.core.plugin.factoryloader: checking directory path "/home/michal/qt-test/build/platforms" ...
    qt.core.library: "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqxcb.so" loaded library
    qt.core.library: "Xcursor" loaded library
    qt.core.plugin.factoryloader: checking directory path "/usr/lib/x86_64-linux-gnu/qt6/plugins/platformthemes" ...
    qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platformthemes/libqgtk3.so"
    qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platformthemes/libqgtk3.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
        "MetaData": {
            "Keys": [
                "gtk3"
            ]
        },
        "archlevel": 1,
        "className": "QGtk3ThemePlugin",
        "debug": false,
        "version": 394240
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("gtk3")
    qt.core.plugin.factoryloader: checking directory path "/home/michal/qt-test/build/platformthemes" ...
    qt.core.library: "/usr/lib/x86_64-linux-gnu/qt6/plugins/platformthemes/libqgtk3.so" loaded library
    qt.core.plugin.factoryloader: checking directory path "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts" ...
    qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so"
    qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1",
        "MetaData": {
            "Keys": [
                "compose",
                "xim"
            ]
        },
        "archlevel": 1,
        "className": "QComposePlatformInputContextPlugin",
        "debug": false,
        "version": 394240
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("compose", "xim")
    qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so"
    qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1",
        "MetaData": {
            "Keys": [
                "ibus"
            ]
        },
        "archlevel": 1,
        "className": "QIbusPlatformInputContextPlugin",
        "debug": false,
        "version": 394240
    }
    
    
    qt.core.plugin.factoryloader: Got keys from plugin meta data QList("ibus")
    qt.core.plugin.factoryloader: checking directory path "/home/michal/qt-test/build/platforminputcontexts" ...
    qt.core.library: "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so" loaded library
    QQmlApplicationEngine failed to load component
    qrc:/qt/qml/qt_test/Main.qml: No such file or directory
    qt.core.plugin.factoryloader: checking directory path "/usr/lib/x86_64-linux-gnu/qt6/plugins/accessiblebridge" ...
    qt.core.plugin.factoryloader: checking directory path "/home/michal/qt-test/build/accessiblebridge" ...
    "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so" unloaded library (faked)
    "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqxcb.so" unloaded library (faked)
    "/usr/lib/x86_64-linux-gnu/qt6/plugins/platformthemes/libqgtk3.so" unloaded library (faked)
    "Xcursor" unloaded library (faked)
    
    

    Project files:
    main.cpp

    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    
    int main(int argc, char *argv[])
    {
        QGuiApplication app(argc, argv);
    
        QQmlApplicationEngine engine;
        const QUrl url(u"qrc:/qt/qml/qt_test/Main.qml"_qs);
        QObject::connect(
            &engine,
            &QQmlApplicationEngine::objectCreationFailed,
            &app,
            []() { QCoreApplication::exit(-1); },
            Qt::QueuedConnection);
        engine.load(url);
    
        return app.exec();
    }
    

    Main.qml

    import QtQuick
    
    Window {
        width: 640
        height: 480
        visible: true
        title: qsTr("Hello World")
    }
    

    CMakeLists.txt

    cmake_minimum_required(VERSION 3.16)
    
    project(qt-test VERSION 0.1 LANGUAGES CXX)
    
    
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    
    find_package(Qt6 6.4 REQUIRED COMPONENTS Core Quick Qml)
    
    qt_standard_project_setup(REQUIRES 6.5)
    
    qt_add_executable(qt-test
        main.cpp
    )
    set_property(TARGET qt-test PROPERTY WIN32_EXECUTABLE true)
    
    qt_add_qml_module(qt-test
        URI qt_test
        VERSION 1.0
        QML_FILES Main.qml
    )
    
    target_link_libraries(qt-test
        PRIVATE Qt6::Core Qt6::Quick Qt6::Qml
    )
    
    install(TARGETS qt-test
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    )
    

    I thought I might need to deploy it first so added code below to CMakeLists.txt but I got a cmake error when doing cmake ...

    qt_generate_deploy_qml_app_script(
        TARGET qt-test
        OUTPUT_SCRIPT deploy_script
    )
    install(SCRIPT ${deploy_script})
    

    cmake Error:

    ...
    -- Found WrapOpenGL: TRUE  
    -- Could NOT find XKB (missing: XKB_LIBRARY XKB_INCLUDE_DIR) (Required is at least version "0.5.0")
    -- Found WrapVulkanHeaders: /usr/include  
    CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt6Qml/Qt6QmlMacros.cmake:2959 (message):
      Unexpected arguments: OUTPUT_SCRIPT;deploy_script
    Call Stack (most recent call first):
      /usr/lib/x86_64-linux-gnu/cmake/Qt6Qml/Qt6QmlMacros.cmake:3104 (qt6_generate_deploy_qml_app_script)
      CMakeLists.txt:32 (qt_generate_deploy_qml_app_script)
    
    
    -- Configuring incomplete, errors occurred!
    

    Could someone tell me what is wrong?

    VRoninV 1 Reply Last reply
    0
    • M michal.19937

      Hello,
      I have a problem - when I build and run a Qt Quick app on Linux Mint 22 no window appears and some Qt metadata is printed to the console. On Windows 11 the same code works though.
      The metadata:

      michal@Mint-VM:~/qt-test/build$ ./qt-test
      qt.core.plugin.factoryloader: checking directory path "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms" ...
      qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqvkkhrdisplay.so"
      qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqvkkhrdisplay.so, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "vkkhrdisplay"
              ]
          },
          "archlevel": 1,
          "className": "QVkKhrDisplayIntegrationPlugin",
          "debug": false,
          "version": 394240
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("vkkhrdisplay")
      qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqlinuxfb.so"
      qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqlinuxfb.so, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "linuxfb"
              ]
          },
          "archlevel": 1,
          "className": "QLinuxFbIntegrationPlugin",
          "debug": false,
          "version": 394240
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("linuxfb")
      qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqxcb.so"
      qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqxcb.so, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "xcb"
              ]
          },
          "archlevel": 1,
          "className": "QXcbIntegrationPlugin",
          "debug": false,
          "version": 394240
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("xcb")
      qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqeglfs.so"
      qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqeglfs.so, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "eglfs"
              ]
          },
          "archlevel": 1,
          "className": "QEglFSIntegrationPlugin",
          "debug": false,
          "version": 394240
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("eglfs")
      qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqvnc.so"
      qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqvnc.so, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "vnc"
              ]
          },
          "archlevel": 1,
          "className": "QVncIntegrationPlugin",
          "debug": false,
          "version": 394240
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("vnc")
      qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqoffscreen.so"
      qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqoffscreen.so, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "offscreen"
              ]
          },
          "archlevel": 1,
          "className": "QOffscreenIntegrationPlugin",
          "debug": false,
          "version": 394240
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("offscreen")
      qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqwayland-generic.so"
      qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqwayland-generic.so, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "wayland"
              ]
          },
          "archlevel": 1,
          "className": "QWaylandIntegrationPlugin",
          "debug": false,
          "version": 394240
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wayland")
      qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqminimal.so"
      qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqminimal.so, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "minimal"
              ]
          },
          "archlevel": 1,
          "className": "QMinimalIntegrationPlugin",
          "debug": false,
          "version": 394240
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimal")
      qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqwayland-egl.so"
      qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqwayland-egl.so, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "wayland-egl"
              ]
          },
          "archlevel": 1,
          "className": "QWaylandEglPlatformIntegrationPlugin",
          "debug": false,
          "version": 394240
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wayland-egl")
      qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqminimalegl.so"
      qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqminimalegl.so, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "minimalegl"
              ]
          },
          "archlevel": 1,
          "className": "QMinimalEglIntegrationPlugin",
          "debug": false,
          "version": 394240
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimalegl")
      qt.core.plugin.factoryloader: checking directory path "/home/michal/qt-test/build/platforms" ...
      qt.core.library: "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqxcb.so" loaded library
      qt.core.library: "Xcursor" loaded library
      qt.core.plugin.factoryloader: checking directory path "/usr/lib/x86_64-linux-gnu/qt6/plugins/platformthemes" ...
      qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platformthemes/libqgtk3.so"
      qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platformthemes/libqgtk3.so, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
          "MetaData": {
              "Keys": [
                  "gtk3"
              ]
          },
          "archlevel": 1,
          "className": "QGtk3ThemePlugin",
          "debug": false,
          "version": 394240
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("gtk3")
      qt.core.plugin.factoryloader: checking directory path "/home/michal/qt-test/build/platformthemes" ...
      qt.core.library: "/usr/lib/x86_64-linux-gnu/qt6/plugins/platformthemes/libqgtk3.so" loaded library
      qt.core.plugin.factoryloader: checking directory path "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts" ...
      qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so"
      qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so, metadata=
      {
          "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1",
          "MetaData": {
              "Keys": [
                  "compose",
                  "xim"
              ]
          },
          "archlevel": 1,
          "className": "QComposePlatformInputContextPlugin",
          "debug": false,
          "version": 394240
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("compose", "xim")
      qt.core.plugin.factoryloader: looking at "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so"
      qt.core.plugin.loader: Found metadata in lib /usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so, metadata=
      {
          "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1",
          "MetaData": {
              "Keys": [
                  "ibus"
              ]
          },
          "archlevel": 1,
          "className": "QIbusPlatformInputContextPlugin",
          "debug": false,
          "version": 394240
      }
      
      
      qt.core.plugin.factoryloader: Got keys from plugin meta data QList("ibus")
      qt.core.plugin.factoryloader: checking directory path "/home/michal/qt-test/build/platforminputcontexts" ...
      qt.core.library: "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so" loaded library
      QQmlApplicationEngine failed to load component
      qrc:/qt/qml/qt_test/Main.qml: No such file or directory
      qt.core.plugin.factoryloader: checking directory path "/usr/lib/x86_64-linux-gnu/qt6/plugins/accessiblebridge" ...
      qt.core.plugin.factoryloader: checking directory path "/home/michal/qt-test/build/accessiblebridge" ...
      "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so" unloaded library (faked)
      "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms/libqxcb.so" unloaded library (faked)
      "/usr/lib/x86_64-linux-gnu/qt6/plugins/platformthemes/libqgtk3.so" unloaded library (faked)
      "Xcursor" unloaded library (faked)
      
      

      Project files:
      main.cpp

      #include <QGuiApplication>
      #include <QQmlApplicationEngine>
      
      int main(int argc, char *argv[])
      {
          QGuiApplication app(argc, argv);
      
          QQmlApplicationEngine engine;
          const QUrl url(u"qrc:/qt/qml/qt_test/Main.qml"_qs);
          QObject::connect(
              &engine,
              &QQmlApplicationEngine::objectCreationFailed,
              &app,
              []() { QCoreApplication::exit(-1); },
              Qt::QueuedConnection);
          engine.load(url);
      
          return app.exec();
      }
      

      Main.qml

      import QtQuick
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      }
      

      CMakeLists.txt

      cmake_minimum_required(VERSION 3.16)
      
      project(qt-test VERSION 0.1 LANGUAGES CXX)
      
      
      set(CMAKE_CXX_STANDARD_REQUIRED ON)
      
      find_package(Qt6 6.4 REQUIRED COMPONENTS Core Quick Qml)
      
      qt_standard_project_setup(REQUIRES 6.5)
      
      qt_add_executable(qt-test
          main.cpp
      )
      set_property(TARGET qt-test PROPERTY WIN32_EXECUTABLE true)
      
      qt_add_qml_module(qt-test
          URI qt_test
          VERSION 1.0
          QML_FILES Main.qml
      )
      
      target_link_libraries(qt-test
          PRIVATE Qt6::Core Qt6::Quick Qt6::Qml
      )
      
      install(TARGETS qt-test
          LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
          RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
      )
      

      I thought I might need to deploy it first so added code below to CMakeLists.txt but I got a cmake error when doing cmake ...

      qt_generate_deploy_qml_app_script(
          TARGET qt-test
          OUTPUT_SCRIPT deploy_script
      )
      install(SCRIPT ${deploy_script})
      

      cmake Error:

      ...
      -- Found WrapOpenGL: TRUE  
      -- Could NOT find XKB (missing: XKB_LIBRARY XKB_INCLUDE_DIR) (Required is at least version "0.5.0")
      -- Found WrapVulkanHeaders: /usr/include  
      CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt6Qml/Qt6QmlMacros.cmake:2959 (message):
        Unexpected arguments: OUTPUT_SCRIPT;deploy_script
      Call Stack (most recent call first):
        /usr/lib/x86_64-linux-gnu/cmake/Qt6Qml/Qt6QmlMacros.cmake:3104 (qt6_generate_deploy_qml_app_script)
        CMakeLists.txt:32 (qt_generate_deploy_qml_app_script)
      
      
      -- Configuring incomplete, errors occurred!
      

      Could someone tell me what is wrong?

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      @michal-19937 said in Qt Quick with cmake fails on Linux:

      cmake_minimum_required(VERSION 3.16)

      from https://doc.qt.io/qt-6/qt-generate-deploy-qml-app-script.html:

      Warning: If you are using a CMake version lower than 3.19, make sure that you pass the MANUAL_FINALIZATION option to qt6_add_executable(), and then call qt6_finalize_target() before calling this function

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      M 1 Reply Last reply
      0
      • VRoninV VRonin

        @michal-19937 said in Qt Quick with cmake fails on Linux:

        cmake_minimum_required(VERSION 3.16)

        from https://doc.qt.io/qt-6/qt-generate-deploy-qml-app-script.html:

        Warning: If you are using a CMake version lower than 3.19, make sure that you pass the MANUAL_FINALIZATION option to qt6_add_executable(), and then call qt6_finalize_target() before calling this function

        M Offline
        M Offline
        michal.19937
        wrote on last edited by
        #3

        @VRonin I set cmake_minimum_required(VERSION 3.28) and it doesn't change anything.

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          Can you post the full cmake Output?

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          M 1 Reply Last reply
          0
          • VRoninV VRonin

            Can you post the full cmake Output?

            M Offline
            M Offline
            michal.19937
            wrote on last edited by
            #5

            @VRonin Sure

            michal@Mint-VM:~/qt-test/build$ cmake ..
            -- The CXX compiler identification is GNU 13.2.0
            -- Detecting CXX compiler ABI info
            -- Detecting CXX compiler ABI info - done
            -- Check for working CXX compiler: /usr/bin/c++ - skipped
            -- Detecting CXX compile features
            -- Detecting CXX compile features - done
            -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
            -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
            -- Found Threads: TRUE  
            -- Performing Test HAVE_STDATOMIC
            -- Performing Test HAVE_STDATOMIC - Success
            -- Found WrapAtomic: TRUE  
            -- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
            -- Found WrapOpenGL: TRUE  
            -- Could NOT find XKB (missing: XKB_LIBRARY XKB_INCLUDE_DIR) (Required is at least version "0.5.0")
            -- Found WrapVulkanHeaders: /usr/include  
            CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt6Qml/Qt6QmlMacros.cmake:2959 (message):
              Unexpected arguments: OUTPUT_SCRIPT;deploy_script
            Call Stack (most recent call first):
              /usr/lib/x86_64-linux-gnu/cmake/Qt6Qml/Qt6QmlMacros.cmake:3104 (qt6_generate_deploy_qml_app_script)
              CMakeLists.txt:32 (qt_generate_deploy_qml_app_script)
            
            
            -- Configuring incomplete, errors occurred!
            

            Full trace: https://drive.google.com/file/d/1R65jCE0caM0J23o6fQU5IC2MN-QALPri/view?usp=sharing

            1 Reply Last reply
            0
            • VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #6

              I can't replicate, sorry, it works fine in my environment. Do you have something specific in your system or is it a plain Mint?

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              1 Reply Last reply
              0
              • M Offline
                M Offline
                michal.19937
                wrote on last edited by
                #7

                No, I don't have anything specific. I managed to get it to work on a fresh Mint, I'll install Qt on main Mint the same way I did on the fresh one and see if it works.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  michal.19937
                  wrote on last edited by michal.19937
                  #8

                  Alright, this nightmare finally ended, I got it to work. I believe the issues were caused by missing packages (qt6-declarative-dev and libxcb-cursor0), me forgetting to update CMAKE_PREFIX_PATH after reinstalling Qt and sometimes not removing hidden files from build directory when clearing. It got confusing with more than one problem. Thank you @VRonin for help.
                  Cheers

                  1 Reply Last reply
                  2
                  • M michal.19937 has marked this topic as solved on
                  • S Offline
                    S Offline
                    shaunrd
                    wrote on last edited by
                    #9

                    I also encountered this message and found very little online, just wanted to share some links for future readers in case it saves them some time. It was quite strange since the documentation for qt_generate_deploy_app_script states This command was introduced in Qt 6.3.. IMHO the version here should be 6.5, since the command was released in preview mode during 6.3 and 6.4 with limited support and a changing interface

                    It looks like the call to find_package in OPs cmake requests Qt 6.4, and from what I can tell qt_generate_deploy_app_script added support for the OUTPUT_SCRIPT parameter in QtCore 6.5. qt_generate_deploy_app_script was in preview mode during Qt 6.4, and only supported Windows and OSX.

                    https://doc.qt.io/archives/qt-6.4/qt-generate-deploy-app-script.html

                    If you're on either of those platforms and want to use Qt 6.4, you might try the FILENAME_VARIABLE instead. I can't speak from experience using this on 6.4 since I'm on Linux. I installed Qt on Ubuntu 24.04 with sudo apt install qt6-base-dev which provided Qt 6.4.2. You can check the Qt version cmake found with the Qt6Core_VERSION variable.

                    message(STATUS "Found Qt6: ${Qt6Core_VERSION}")
                    

                    Qt 6.5 however supports Windows / Mac / Linux and the OUTPUT_SCRIPT parameter.

                    https://doc.qt.io/qt-6.5/qt-generate-deploy-app-script.html

                    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