【问题标题】:How to cross-compile a Qt Quick application for the Raspberry Pi?如何为 Raspberry Pi 交叉编译 Qt Quick 应用程序?
【发布时间】:2016-03-16 12:05:51
【问题描述】:

我成功地为 Raspberry Pi 交叉编译了“标准”Qt 应用程序 (QT += core gui),但我在使用 Qt Quick (QT += quick) 时遇到了麻烦。

我安装了cross-compiling tool-chain 并成功安装了compiled Qt with it,我的Qt GUI 应用程序现在可以在Raspberry Pi 上运行。

现在我尝试在 Raspberry Pi 上运行一个 Qt Quick 示例,但没有成功。我从 Welcome/Examples 打开示例,我可以使用 Debian 在我的 PC 上成功构建和运行它们,但是如果我尝试为 Raspberry Pi 构建它(通过添加用于常规 Qt 应用程序的相同工具包),它不会甚至不编译。它给出了以下错误:

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

这似乎表明 Qt Quick 不是我的 Qt 构建的一部分。

我再次检查了交叉编译器是如何配置的:

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 甚至没有出现在选项列表中。这是否意味着交叉编译器不支持它? “QML 调试”选项让我觉得它应该是,因为如果不是 Qt Quick,还有什么应该使用 QML。

OpenGL 2.0 处于活动状态,所以这应该不是问题。

【问题讨论】:

    标签: qt raspberry-pi cross-compiling


    【解决方案1】:

    由于我的 PC 确实有一个 Qt5Quick 库,并且 Raspberry Pi 上没有具有此名称的库,因此它似乎根本没有构建。

    指南按依赖顺序列出了可选模块,但还不够。

    构建qtquickcontrolsqtquick2后,问题解决了。

    安装 SD 卡的映像后,

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

    对于其他人以此类推。然后将镜像写回 SD 卡,Qt Quick 就可以在树莓派上运行(即使只是全屏)。

    【讨论】:

    • 如何为您的设备构建这些库?我有同样的问题。我有 ARM 设备。如何交叉编译设备的 qml 库?
    • @H.Ghassami:你能交叉编译基本(非 qml)Qt 库吗?如果您不能,请点击问题开头的链接,了解如何设置gnueabi。如果交叉编译 Qt 本身没有问题,只缺少 qml,那么使用已经存在的交叉编译器来构建这个答案中提到的两个库。
    • 我的问题只是 qml。你的意思是我写了cd ~/opt/qt5/qtquickcontrols /usr/local/qt5pi/bin/qmake . make -j4 sudo make install
    • @H.Ghassami :你有那个地方那两个图书馆的资源吗?也许他们在 5.7 版本中有不同的名称?我用 5.6 完成了我的
    • 感谢您的回复。我没有任何 qml 库的来源。
    【解决方案2】:

    我在 Raspberry 3 上成功使用了 QtRpi 脚本。您可以在 http://www.qtrpi.com 下载它,它是一个现成的工具,可以在您的 Linux 主机 PC 上安装交叉编译器工具链,并在 Rpi 上提供完整的部署环境。

    我将它与 Qt Quick 一起用于我的应用程序,它运行没有任何问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-12
      • 1970-01-01
      • 1970-01-01
      • 2016-01-21
      • 2012-07-19
      • 2012-06-28
      相关资源
      最近更新 更多