4

I successfully cross-compiled "standard" Qt applications (QT += core gui) for a Raspberry Pi, but I'm having trouble to do the same with Qt Quick (QT += quick).

I installed a cross-compiling tool-chain and successfully compiled Qt with it, and my Qt GUI applications can now run on the Raspberry Pi.

Now I tried to run one of the Qt Quick examples on the Raspberry Pi, without success. I open the example from Welcome/Examples, I can successfully build and run them on my PC with Debian, but if I try to build it for the Raspberry Pi (by adding the same kit I used for the regular Qt applications), it doesn't even compile. It gives the following error:

:-1: error: Unknown module(s) in QT: quick

This seems to indicate that Qt Quick is not part of my Qt build.

I checked again how the cross-compiler is configured:

Building on:   linux-g++ (x86_64, CPU features: mmx sse sse2)
Building for:  devices/linux-rasp-pi-g++ (arm, CPU features: none detected)
Platform notes:

            - Also available for Linux: linux-clang linux-kcc linux-icc linux-cxx

Build options:
  Configuration .......... accessibility audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent cross_compile dbus egl eglfs eglfs_brcm enable_new_dtags evdev eventfd freetype full-config getaddrinfo getifaddrs harfbuzz iconv inotify ipv6ifname large-config largefile linuxfb medium-config minimal-config mremap nis no-pkg-config opengl opengles2 pcre png posix_fallocate precompile_header qpa qpa reduce_exports release rpath shared small-config system-zlib threadsafe-cloexec 
  Build parts ............  libs
  Mode ................... release
  Using sanitizer(s)...... none
  Using C++ standard ..... c++11
  Using gold linker....... no
  Using new DTAGS ........ yes
  Using PCH .............. yes
  Target compiler supports:
    Neon ................. no

Qt modules and options:
  Qt D-Bus ............... yes (loading dbus-1 at runtime)
  Qt Concurrent .......... yes
  Qt GUI ................. yes
  Qt Widgets ............. yes
  Large File ............. yes
  QML debugging .......... yes
  Use system proxies ..... no

Support enabled for:
  Accessibility .......... yes
  ALSA ................... no
  CUPS ................... no
  Evdev .................. yes
  FontConfig ............. no
  FreeType ............... yes (bundled copy)
  Glib ................... no
  GStreamer .............. no
  GTK theme .............. no
  HarfBuzz ............... yes (bundled copy)
  Iconv .................. yes
  ICU .................... no
  Image formats: 
    GIF .................. yes (plugin, using bundled copy)
    JPEG ................. yes (plugin, using bundled copy)
    PNG .................. yes (in QtGui, using bundled copy)
  libinput................ no
  Logging backends: 
    journald ............... no
    syslog   ............... no
  mtdev .................. no
  Networking: 
    getaddrinfo .......... yes
    getifaddrs ........... yes
    IPv6 ifname .......... yes
    libproxy.............. no
    OpenSSL .............. no
  NIS .................... yes
  OpenGL / OpenVG: 
    EGL .................. yes
    OpenGL ............... yes (OpenGL ES 2.0+)
    OpenVG ............... no
  PCRE ................... yes (bundled copy)
  pkg-config ............. no 
  PulseAudio ............. no
  QPA backends: 
    DirectFB ............. no
    EGLFS ................ yes
      EGLFS i.MX6....... . no
      EGLFS KMS .......... no
      EGLFS Mali ......... no
      EGLFS Raspberry Pi . yes
      EGLFS X11 .......... no
    LinuxFB .............. yes
    Mir client............ no
    XCB .................. no
  Session management ..... yes
  SQL drivers: 
    DB2 .................. no
    InterBase ............ no
    MySQL ................ no
    OCI .................. no
    ODBC ................. no
    PostgreSQL ........... no
    SQLite 2 ............. no
    SQLite ............... yes (plugin, using bundled copy)
    TDS .................. no
  tslib .................. no
  udev ................... no
  xkbcommon-x11........... no
  xkbcommon-evdev......... no
  zlib ................... yes (system library)

Qt Quick doesn't even appear in the list of options. Does this mean that the cross-compiler doesn't support it? The option "QML debugging" makes me think that it should be, because what else should be using QML if not Qt Quick.

OpenGL 2.0 is active, so that shouldn't be the problem.

Community
  • 1
  • 1
vsz
  • 4,811
  • 7
  • 41
  • 78

2 Answers2

2

As my PC did have a Qt5Quick library and there was no library with this name on the Raspberry Pi, it seems it simply wasn't built.

The guide lists the optional modules in an order of dependency, but they were not enough.

After building the qtquickcontrols and qtquick2, the problem was solved.

With the image of the SD card mounted,

cd ~/opt/qt5/qtquickcontrols
/usr/local/qt5pi/bin/qmake .
make -j4
sudo make install

And so on for the others. Then write the image back to the SD card, and Qt Quick can run (even if only full-screen) on the Raspberry Pi.

vsz
  • 4,811
  • 7
  • 41
  • 78
  • How do you build that libs for your device? I have a same problem. I have ARM device. How to cross compile qml libs for device? – H.Ghassami Oct 08 '16 at 07:53
  • @H.Ghassami : Could you cross-compile basic (non-qml) Qt libs? If you couldn't, then follow the links at the beginning of the question about setting up `gnueabi`. If cross-compiling Qt itself is not a problem and only qml is missing, then use the already existing cross-compiler to build the two libraries mentioned in this answer. – vsz Oct 08 '16 at 08:12
  • my problem is just qml. you mean I wrote `cd ~/opt/qt5/qtquickcontrols /usr/local/qt5pi/bin/qmake . make -j4 sudo make install` – H.Ghassami Oct 09 '16 at 05:24
  • @H.Ghassami : Do you have the sources for those two libraries at that location? Maybe they have a different name in the 5.7 version? I did mine with 5.6 – vsz Oct 09 '16 at 08:13
  • thanks for reply. I don't have any source for qml libs. – H.Ghassami Oct 09 '16 at 08:51
  • @H.Ghassami : Then how did you compile Qt to your ARM device? You need to compile Qt from source. You have to install a cross-compiler, have to download the source of Qt, and have to create all the makefiles first. Please refer to the links in the original question, especially http://wiki.qt.io/RaspberryPi_Beginners_Guide . Only if that is working, do you have worry about QML at all. Maybe I'm wrong, but I couldn't find any way of using just QML alone on an ARM device without first cross-compiling Qt itself. – vsz Oct 09 '16 at 10:44
1

I used QtRpi script successfully with a Raspberry 3. You can download it at http://www.qtrpi.com, it's a ready to use tools to install a cross compiler toolchain on your Linux host pc and a complete deployment environment on Rpi.

I use it with Qt Quick for my applications, it runs without any problem.