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 5.15.2 Raspberry Pi 4 cross-compile with CMake. 'module "QtQuick.Window" is not installed'
Forum Updated to NodeBB v4.3 + New Features

Qt 5.15.2 Raspberry Pi 4 cross-compile with CMake. 'module "QtQuick.Window" is not installed'

Scheduled Pinned Locked Moved Solved General and Desktop
cmakeraspberry pi 4qt5.15.2qtquick
2 Posts 1 Posters 1.4k Views 1 Watching
  • 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.
  • F Offline
    F Offline
    Fahad-Cattchi
    wrote on 14 Dec 2021, 20:24 last edited by Fahad-Cattchi
    #1

    How can I tell my Qt application where the modules are when it runs?


    I followed some tutorials online on how to cross-compile Qt 5.15.2 for the Raspberry Pi, including (but not limited to) this one: https://mechatronicsblog.com/cross-compile-and-deploy-qt-5-12-for-raspberry-pi/

    I was able to get the code compiled and moved over to the Pi. My Qt project builds and deploys fine (and runs locally), but will not run on the Pi due to the missing QtQuick module.
    However, I do have QtQuick on my Pi at /usr/local/qt5.15/qml/QtQuick. These are the individual modules in the folder:

    Controls    Extras        Particles.2     Scene3D      Timeline         XmlListModel
    Controls.2  Layouts       PrivateWidgets  Shapes       VirtualKeyboard
    Dialogs     LocalStorage  Scene2D         Templates.2  Window.2
    

    My main.qml is simple:

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

    I have a CMake toolchain file that looks like this:

    set(CMAKE_SYSTEM_NAME Linux)
    set(CMAKE_SYSTEM_PROCESSOR arm)
    
    set(CMAKE_INSTALL_PREFIX /home/pi/install)
    set(CMAKE_PREFIX_PATH /usr/local/qt5.15)
    
    set(PI_ROOT /home/fahad/pi)
    set(CMAKE_SYSROOT ${PI_ROOT}/sysroot)
    set(CROSS_COMPILER ${PI_ROOT}/tools)
    set(CMAKE_C_COMPILER ${CROSS_COMPILER}/arm-linux-gnueabihf-gcc)
    set(CMAKE_CXX_COMPILER ${CROSS_COMPILER}/arm-linux-gnueabihf-g++)
    
    set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
    set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
    set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
    set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
    

    I thought the set(CMAKE_PREFIX_PATH /usr/local/qt5.15 line would tell the Qt application where the modules are when it runs.

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Fahad-Cattchi
      wrote on 14 Dec 2021, 22:32 last edited by Fahad-Cattchi
      #2

      On the Raspberry Pi, in the terminal before running my application, I had to run export QML2_IMPORT_PATH=/usr/local/qt5.15/qml and that fixed it.

      I put that line in my ~/.profile and it seems to have fixed it permanently. I no longer have to run the export command manually.

      1 Reply Last reply
      1

      1/2

      14 Dec 2021, 20:24

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved