导航

    全志在线开发者论坛

    • 注册
    • 登录
    • 搜索
    • 版块
    • 话题
    • 在线文档
    • 社区主页
    1. 主页
    2. leesum
    L
    • 资料
    • 关注 0
    • 粉丝 0
    • 我的积分 440
    • 主题 4
    • 帖子 6
    • 最佳 2
    • 群组 0

    leesumLV 3

    @leesum

    440
    积分
    3
    声望
    8
    资料浏览
    6
    帖子
    0
    粉丝
    0
    关注
    注册时间 最后登录

    leesum 取消关注 关注

    leesum 发布的最佳帖子

    • 全志D1-H,官方SDK Tina2.0 移植 QT5.15

      移植QT5.15

      Host:Linux环境:(阿里云虚拟机)

      Linux version 5.4.0-110-generic (buildd@ubuntu) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)) #124-Ubuntu SMP Thu Apr 14 19:46:19 UTC 2022

      Target:Linux环境(DockRV)

      Linux version 5.4.61 (root@aly) (riscv64-unknown-linux-gnu-gcc (C-SKY RISCV Tools V1.8.4 B20200702) 8.1.0, GNU ld (GNU Binutils) 2.32) #10 PREEMPT Sat May 28 12:08:35 UTC 2022

      参考链接:

      基于qemu-riscv从0开始构建嵌入式linux系统ch23. linux FB应用——Qt库移植 - CodeAntenna

      基于qemu-riscv从0开始构建嵌入式linux系统ch23. linux FB应用——Qt库移植_Quard_D的博客-CSDN博客

      Qt-5.3.2 在友善Smart210开发板的移植记录_NewThinker_wei的博客-CSDN博客

      移植QT5.9.1 — Lichee zero 文档

      下载源码

      本次移植的是QT5.15.4,需要在Linux上交叉编译移植到RISC-V开发板上

      点击下载QT5.15.4

      wget https://mirrors.tuna.tsinghua.edu.cn/qt/official_releases/qt/5.15/5.15.4/single/qt-everywhere-opensource-src-5.15.4.tar.xz
      
      tar zxvf qt-everywhere-opensource-src-5.15.4.tar.xz
      cd qt-everywhere-opensource-src-5.15.4
      

      解压完毕后进入QT源码目录

      环境配置

      配置交叉编译工具链

      添加交叉编译配置文件qt-everywhere-src-5.15.4/qtbase/mkspecs/linux-riscv64-gnu-g++/qmake.conf,内容如下:

      # qmake configuration for building with riscv64-unknown-linux-gnu-g++no
      MAKEFILE_GENERATOR      = UNIX
      CONFIG                 += incremental
      QMAKE_INCREMENTAL_STYLE = sublib
      
      include(../common/linux.conf)
      include(../common/gcc-base-unix.conf)
      include(../common/g++-unix.conf)
      
      # modifications to g++.conf
      QMAKE_CC                = riscv64-unknown-linux-gnu-gcc   # 需要使用的交叉编译工具链的名称
      QMAKE_CXX               = riscv64-unknown-linux-gnu-g++
      QMAKE_LINK              = riscv64-unknown-linux-gnu-g++ 
      QMAKE_LINK_SHLIB        = riscv64-unknown-linux-gnu-g++
      QMAKE_LIBS              = -latomic
      
      # modifications to linux.conf
      QMAKE_AR                = riscv64-unknown-linux-gnu-ar cqs
      QMAKE_OBJCOPY           = riscv64-unknown-linux-gnu-objcopy
      QMAKE_NM                = riscv64-unknown-linux-gnu-nm -P
      QMAKE_STRIP             = riscv64-unknown-linux-gnu-strip
      load(qt_config)
      

      添加编译配置文件qt-everywhere-src-5.15.4/qtbase/mkspecs/linux-riscv64-gnu-g++/qplatformdefs.h,内容如下:

      /****************************************************************************
      **
      ** Copyright (C) 2017 The Qt Company Ltd.
      ** Contact: https://www.qt.io/licensing/
      **
      ** This file is part of the qmake spec of the Qt Toolkit.
      **
      ** $QT_BEGIN_LICENSE:LGPL$
      ** Commercial License Usage
      ** Licensees holding valid commercial Qt licenses may use this file in
      ** accordance with the commercial license agreement provided with the
      ** Software or, alternatively, in accordance with the terms contained in
      ** a written agreement between you and The Qt Company. For licensing terms
      ** and conditions see https://www.qt.io/terms-conditions. For further
      ** information use the contact form at https://www.qt.io/contact-us.
      **
      ** GNU Lesser General Public License Usage
      ** Alternatively, this file may be used under the terms of the GNU Lesser
      ** General Public License version 3 as published by the Free Software
      ** Foundation and appearing in the file LICENSE.LGPL3 included in the
      ** packaging of this file. Please review the following information to
      ** ensure the GNU Lesser General Public License version 3 requirements
      ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
      **
      ** GNU General Public License Usage
      ** Alternatively, this file may be used under the terms of the GNU
      ** General Public License version 2.0 or (at your option) the GNU General
      ** Public license version 3 or any later version approved by the KDE Free
      ** Qt Foundation. The licenses are as published by the Free Software
      ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
      ** included in the packaging of this file. Please review the following
      ** information to ensure the GNU General Public License requirements will
      ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
      ** https://www.gnu.org/licenses/gpl-3.0.html.
      **
      ** $QT_END_LICENSE$
      **
      ****************************************************************************/
      
      #include "../linux-g++/qplatformdefs.h"
      

      修改源码中一个缺失的头文件包含,位于 qt-everywhere-src-5.15.4/qtdeclarative/src/qmldebug/qqmlprofilerevent_p.h :52行,添加如下内容:

      #include <limits>
      

      在QT源码根目录创建 configure 自动配置文件

      vi autoConfigure.sh
      

      文件内容如下,具体配置意思自己百度。

      export PATH=$PATH:/home/leesum/tina-d1-h/prebuilt/gcc/linux-x86/riscv/toolchain-thead-glibc/riscv64-glibc-gcc-thead_20200702/bin/
      ./configure -prefix ./riscv-qt \
              -opensource \
              -confirm-license \
              -release \
              -strip \
              -shared \
              -xplatform linux-riscv64-gnu-g++ \      
              -optimized-qmake \
              -c++std c++11 \
              --rpath=no \
              -pch \
              -skip qt3d \
              -skip qtactiveqt \
              -skip qtandroidextras \
              -skip qtcanvas3d \
              -skip qtconnectivity \
              -skip qtdatavis3d \
              -skip qtdoc \
              -skip qtgamepad \
              -skip qtlocation \
              -skip qtmacextras \
              -skip qtnetworkauth \
              -skip qtpurchasing \
              -skip qtremoteobjects \
              -skip qtscript \
              -skip qtscxml \
              -skip qtsensors \
              -skip qtspeech \
              -skip qtsvg \
              -skip qttools \
              -skip qttranslations \
              -skip qtwayland \
              -skip qtwebengine \
              -skip qtwebview \
              -skip qtwinextras \
              -skip qtx11extras \
              -skip qtxmlpatterns \
              -make libs \
              -make examples \
              -nomake tools -nomake tests \
              -gui \
              -widgets \
              -dbus-runtime \
              --glib=no \
              --iconv=no \
              --pcre=qt \
              --zlib=qt \
              -no-openssl \
              --freetype=qt \
              --harfbuzz=qt \
              -no-opengl \
              -linuxfb \
              --xcb=no \
              -tslib \
              --libpng=qt \
              --libjpeg=qt \
              --sqlite=qt \
              -plugin-sql-sqlite \
              -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/ \
              -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/allwinner/ \
              -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/allwinner/include/ \
              -L/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/lib/ \
              -recheck-all
      

      几个关键的配置选项说明介绍一下

      • -xplatform linux-riscv64-gnu-g++:

      linux-riscv64-gnu-g++ 就是刚刚创建的配置文件夹里面有刚刚创建的qmake.conf qplatformdefs.h,指明了所使用的交叉编译工具链。

      • -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/
      • -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/allwinner/
      • -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/allwinner/include/

      指示说明库头文件的位置

      • -L/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/lib/

      说明库的位置

      • export PATH=$PATH:/home/leesum/tina-d1-h/prebuilt/gcc/linux-x86/riscv/toolchain-thead-glibc/riscv64-glibc-gcc-thead_20200702/bin/

      说明交叉编译工具链的位置

      位置参考自己Tina-SDK的下载目录

      为autoConfigure.sh添加可执行权限

      chmod +x autoConfigure.sh
      

      交叉编译QT5

      进入QT源码根目录,运行刚刚配置的环境。

      source ./autoConfigure.sh
      

      若配置成功会显示以下信息

      image-20220529224209489

      开始编译,具体核心数按照自己的配置指定,预留 8G 空间已足够使用。

      make -j2
      

      我按照以上配置一次编译成功,没有遇见错误。

      编译成功后执行

      make install
      

      安装目录在qt-everywhere-src-5.15.4/qtbase/bin/riscv-qt

      riscv-qt 就是刚刚配置文件中-prefix ./riscv-qt指定的目录。

      将该目录移动到DockRV开发板上,具体方法可以 tar 打包后通过 adb push 或者SFTP发送。

      测试examples

      进入QT5目录,创建环境配置文件 qt-path

      vi qt-path
      
      #内容如下
      echo begin
      export QT_HOME=/root/bin/riscv-qt
      export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
      export QT_QPA_FB_DRM=1
      export QT_QPA_GENERIC_PLUGINS=evdevkeyboard
      export QT_QPA_GENERIC_PLUGINS=evdevmouse
      export QT_QPA_EVDEV_MOUSE_PARAMETERS=/dev/input/event1
      export QT_QPA_EVDEV_KEYBOARD_PARAMETERS=/dev/input/event0
      export QT_PLUGIN_PATH=$QT_HOME/plugins
      export LD_LIBRARY_PATH=/lib:/usr/lib:/$QT_HOME/lib
      

      鼠标和键盘具体的 /dev/input/eventx 可以通过getevent获得

      image-20220529230516666

      激活QT运行环境

      source ./qt-path
      

      如果显示

      ./zoomlinechart: error while loading shared libraries: libQt5Charts.so.5: cannot open shared object file: No such file or directory
      

      检查 qt-path 的 LIB 配置

      进入 example 目录,运行自带例程

      cd examples/gui/analogclock
      chmod +x analogclock
      ./analogclock
      

      image-20220529231446060

      HDMI接口显示正常,并且鼠标能够正常移动,可自行测试其他example

      由于移植的QT5所有的绘制都是基于软件实现的,运行效果很卡,有好的解决方法可以相互交流。

      字体问题也有待解决

      image-20220529232317262

      解决QT5字体问题

      因为编译的源码库中没有自带fonts,所以不能显示文字。

      进入开发板QT5目录,在 lib 文件夹中创建 fonts 文件夹

      mkdir lib/fonts
      

      下载 TTF 字体文件 将字体放入刚刚创建的 fonts 文件夹中。
      adobe-fonts/source-sans: Sans serif font family for user interface environments (github.com)

      测试

      发布在 MR Series
      L
      leesum
    • 全志D1-H,官方SDK Tina2.0 移植 ffmpeg (交叉编译成功,运行时出问题)

      移植ffmpeg

      CompilationGuide/Generic – FFmpeg
      FFmpeg-4.3.2 嵌入式Linux交叉编译_qq_29994663的博客-CSDN博客_交叉编译ffmpeg

      下载源码

      wget https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
      tar xvf ffmpeg-snapshot.tar.bz2
      cd ffmpeg
      

      环境配置

      在 ffmpeg 源码根目录创建自动配置文件 autogen.sh

      export PATH=$PATH:/home/leesum/tina-d1-h/prebuilt/gcc/linux-x86/riscv/toolchain-thead-glibc/riscv64-glibc-gcc-thead_20200702/bin/
      
      ./configure \
              --prefix="./riscv-ffmpeg"\
              --enable-shared \
              --enable-cross-compile \
              --cross-prefix=riscv64-unknown-linux-gnu- \
              --target-os=linux \
              --arch=riscv \
              --enable-gpl \
              --enable-libx264 \
              --enable-libfdk-aac \
              --enable-nonfree \
              --extra-cflags="-I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/ -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/allwinner/ -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/allwinner/include/" \
              --extra-ldflags="-L/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/lib/" \
              --extra-libs=-ldl
      
      

      激活环境

      chmod +x autogen.sh
      source ./autogen.sh
      

      没有报错就是配置成功

      交叉编译ffmpeg

      make -j2
      

      大约十分钟会编译成功,按照如上配置,我一次编译成功没有报错
      一次编译成功,没有报错

      make install
      

      进入设定的 --prefix 目录,

      cd riscv-ffmpeg
      cd bin
      file ffmpeg
      

      查看可执行文件类型,确实为 riscv64 可执行文件

      ➜  bin file ffmpeg
      ffmpeg: ELF 64-bit LSB executable, UCB RISC-V, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv64xthead-lp64d.so.1, for GNU/Linu
      ➜  bin
      

      将 riscv-ffmpeg 目录下的文件打包发送至开发板

      找不到动态库

      ffmpeg环境变量设置和安装后不能加载共享库的错误解决_Jensen Lee的博客-程序员宅基地 - 程序员宅基地 (cxyzjd.com)

      报错:报错找不到动态库

      ./ffmpeg: error while loading shared libraries: libx264.so: cannot open shared object file: No such file or directory
      

      根据报错信息可知缺少 libx264.so 这个动态库,进入 TinaSDK 根目录,搜索 libx264.so 将这个动态库复制到开发板中。

      find -name "libx264.so"
      


      进入目录 ls

      file 命令查看文件属性

      libx264.so.157: ELF 64-bit LSB shared object, UCB RISC-V, version 1 (SYSV), dynamically linked, with debug_info, not stripped
      

      libx264.so 是 libx264.so.157 的软连接,需要将这两个文件复制到开发板中的 lib 目录,或者 ffmpeg 根目录中的 lib 目录。
      在这里我将这两个文件复制到了 riscv-ffmpeg/lib 目录下。

      添加动态链接库的位置和环境变量的位置

      export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/riscv-ffmpeg/lib
      export PATH=$PATH:/root/riscv-ffmpeg/bin
      

      运行 ffmpeg 显示下图则移植成功。

      出现问题

      虽然 ffmpeg 有显示,但是运行命令时会出现 Segmentation fault 错误,不知道如何解决,可能是配置的问题。

      发布在 MR Series
      L
      leesum

    leesum 发布的最新帖子

    • 全志D1-H,官方SDK Tina2.0 移植 ffmpeg (交叉编译成功,运行时出问题)

      移植ffmpeg

      CompilationGuide/Generic – FFmpeg
      FFmpeg-4.3.2 嵌入式Linux交叉编译_qq_29994663的博客-CSDN博客_交叉编译ffmpeg

      下载源码

      wget https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
      tar xvf ffmpeg-snapshot.tar.bz2
      cd ffmpeg
      

      环境配置

      在 ffmpeg 源码根目录创建自动配置文件 autogen.sh

      export PATH=$PATH:/home/leesum/tina-d1-h/prebuilt/gcc/linux-x86/riscv/toolchain-thead-glibc/riscv64-glibc-gcc-thead_20200702/bin/
      
      ./configure \
              --prefix="./riscv-ffmpeg"\
              --enable-shared \
              --enable-cross-compile \
              --cross-prefix=riscv64-unknown-linux-gnu- \
              --target-os=linux \
              --arch=riscv \
              --enable-gpl \
              --enable-libx264 \
              --enable-libfdk-aac \
              --enable-nonfree \
              --extra-cflags="-I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/ -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/allwinner/ -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/allwinner/include/" \
              --extra-ldflags="-L/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/lib/" \
              --extra-libs=-ldl
      
      

      激活环境

      chmod +x autogen.sh
      source ./autogen.sh
      

      没有报错就是配置成功

      交叉编译ffmpeg

      make -j2
      

      大约十分钟会编译成功,按照如上配置,我一次编译成功没有报错
      一次编译成功,没有报错

      make install
      

      进入设定的 --prefix 目录,

      cd riscv-ffmpeg
      cd bin
      file ffmpeg
      

      查看可执行文件类型,确实为 riscv64 可执行文件

      ➜  bin file ffmpeg
      ffmpeg: ELF 64-bit LSB executable, UCB RISC-V, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-riscv64xthead-lp64d.so.1, for GNU/Linu
      ➜  bin
      

      将 riscv-ffmpeg 目录下的文件打包发送至开发板

      找不到动态库

      ffmpeg环境变量设置和安装后不能加载共享库的错误解决_Jensen Lee的博客-程序员宅基地 - 程序员宅基地 (cxyzjd.com)

      报错:报错找不到动态库

      ./ffmpeg: error while loading shared libraries: libx264.so: cannot open shared object file: No such file or directory
      

      根据报错信息可知缺少 libx264.so 这个动态库,进入 TinaSDK 根目录,搜索 libx264.so 将这个动态库复制到开发板中。

      find -name "libx264.so"
      


      进入目录 ls

      file 命令查看文件属性

      libx264.so.157: ELF 64-bit LSB shared object, UCB RISC-V, version 1 (SYSV), dynamically linked, with debug_info, not stripped
      

      libx264.so 是 libx264.so.157 的软连接,需要将这两个文件复制到开发板中的 lib 目录,或者 ffmpeg 根目录中的 lib 目录。
      在这里我将这两个文件复制到了 riscv-ffmpeg/lib 目录下。

      添加动态链接库的位置和环境变量的位置

      export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/riscv-ffmpeg/lib
      export PATH=$PATH:/root/riscv-ffmpeg/bin
      

      运行 ffmpeg 显示下图则移植成功。

      出现问题

      虽然 ffmpeg 有显示,但是运行命令时会出现 Segmentation fault 错误,不知道如何解决,可能是配置的问题。

      发布在 MR Series
      L
      leesum
    • 全志D1-H,官方SDK Tina2.0 移植 QT5.15

      移植QT5.15

      Host:Linux环境:(阿里云虚拟机)

      Linux version 5.4.0-110-generic (buildd@ubuntu) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)) #124-Ubuntu SMP Thu Apr 14 19:46:19 UTC 2022

      Target:Linux环境(DockRV)

      Linux version 5.4.61 (root@aly) (riscv64-unknown-linux-gnu-gcc (C-SKY RISCV Tools V1.8.4 B20200702) 8.1.0, GNU ld (GNU Binutils) 2.32) #10 PREEMPT Sat May 28 12:08:35 UTC 2022

      参考链接:

      基于qemu-riscv从0开始构建嵌入式linux系统ch23. linux FB应用——Qt库移植 - CodeAntenna

      基于qemu-riscv从0开始构建嵌入式linux系统ch23. linux FB应用——Qt库移植_Quard_D的博客-CSDN博客

      Qt-5.3.2 在友善Smart210开发板的移植记录_NewThinker_wei的博客-CSDN博客

      移植QT5.9.1 — Lichee zero 文档

      下载源码

      本次移植的是QT5.15.4,需要在Linux上交叉编译移植到RISC-V开发板上

      点击下载QT5.15.4

      wget https://mirrors.tuna.tsinghua.edu.cn/qt/official_releases/qt/5.15/5.15.4/single/qt-everywhere-opensource-src-5.15.4.tar.xz
      
      tar zxvf qt-everywhere-opensource-src-5.15.4.tar.xz
      cd qt-everywhere-opensource-src-5.15.4
      

      解压完毕后进入QT源码目录

      环境配置

      配置交叉编译工具链

      添加交叉编译配置文件qt-everywhere-src-5.15.4/qtbase/mkspecs/linux-riscv64-gnu-g++/qmake.conf,内容如下:

      # qmake configuration for building with riscv64-unknown-linux-gnu-g++no
      MAKEFILE_GENERATOR      = UNIX
      CONFIG                 += incremental
      QMAKE_INCREMENTAL_STYLE = sublib
      
      include(../common/linux.conf)
      include(../common/gcc-base-unix.conf)
      include(../common/g++-unix.conf)
      
      # modifications to g++.conf
      QMAKE_CC                = riscv64-unknown-linux-gnu-gcc   # 需要使用的交叉编译工具链的名称
      QMAKE_CXX               = riscv64-unknown-linux-gnu-g++
      QMAKE_LINK              = riscv64-unknown-linux-gnu-g++ 
      QMAKE_LINK_SHLIB        = riscv64-unknown-linux-gnu-g++
      QMAKE_LIBS              = -latomic
      
      # modifications to linux.conf
      QMAKE_AR                = riscv64-unknown-linux-gnu-ar cqs
      QMAKE_OBJCOPY           = riscv64-unknown-linux-gnu-objcopy
      QMAKE_NM                = riscv64-unknown-linux-gnu-nm -P
      QMAKE_STRIP             = riscv64-unknown-linux-gnu-strip
      load(qt_config)
      

      添加编译配置文件qt-everywhere-src-5.15.4/qtbase/mkspecs/linux-riscv64-gnu-g++/qplatformdefs.h,内容如下:

      /****************************************************************************
      **
      ** Copyright (C) 2017 The Qt Company Ltd.
      ** Contact: https://www.qt.io/licensing/
      **
      ** This file is part of the qmake spec of the Qt Toolkit.
      **
      ** $QT_BEGIN_LICENSE:LGPL$
      ** Commercial License Usage
      ** Licensees holding valid commercial Qt licenses may use this file in
      ** accordance with the commercial license agreement provided with the
      ** Software or, alternatively, in accordance with the terms contained in
      ** a written agreement between you and The Qt Company. For licensing terms
      ** and conditions see https://www.qt.io/terms-conditions. For further
      ** information use the contact form at https://www.qt.io/contact-us.
      **
      ** GNU Lesser General Public License Usage
      ** Alternatively, this file may be used under the terms of the GNU Lesser
      ** General Public License version 3 as published by the Free Software
      ** Foundation and appearing in the file LICENSE.LGPL3 included in the
      ** packaging of this file. Please review the following information to
      ** ensure the GNU Lesser General Public License version 3 requirements
      ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
      **
      ** GNU General Public License Usage
      ** Alternatively, this file may be used under the terms of the GNU
      ** General Public License version 2.0 or (at your option) the GNU General
      ** Public license version 3 or any later version approved by the KDE Free
      ** Qt Foundation. The licenses are as published by the Free Software
      ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
      ** included in the packaging of this file. Please review the following
      ** information to ensure the GNU General Public License requirements will
      ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
      ** https://www.gnu.org/licenses/gpl-3.0.html.
      **
      ** $QT_END_LICENSE$
      **
      ****************************************************************************/
      
      #include "../linux-g++/qplatformdefs.h"
      

      修改源码中一个缺失的头文件包含,位于 qt-everywhere-src-5.15.4/qtdeclarative/src/qmldebug/qqmlprofilerevent_p.h :52行,添加如下内容:

      #include <limits>
      

      在QT源码根目录创建 configure 自动配置文件

      vi autoConfigure.sh
      

      文件内容如下,具体配置意思自己百度。

      export PATH=$PATH:/home/leesum/tina-d1-h/prebuilt/gcc/linux-x86/riscv/toolchain-thead-glibc/riscv64-glibc-gcc-thead_20200702/bin/
      ./configure -prefix ./riscv-qt \
              -opensource \
              -confirm-license \
              -release \
              -strip \
              -shared \
              -xplatform linux-riscv64-gnu-g++ \      
              -optimized-qmake \
              -c++std c++11 \
              --rpath=no \
              -pch \
              -skip qt3d \
              -skip qtactiveqt \
              -skip qtandroidextras \
              -skip qtcanvas3d \
              -skip qtconnectivity \
              -skip qtdatavis3d \
              -skip qtdoc \
              -skip qtgamepad \
              -skip qtlocation \
              -skip qtmacextras \
              -skip qtnetworkauth \
              -skip qtpurchasing \
              -skip qtremoteobjects \
              -skip qtscript \
              -skip qtscxml \
              -skip qtsensors \
              -skip qtspeech \
              -skip qtsvg \
              -skip qttools \
              -skip qttranslations \
              -skip qtwayland \
              -skip qtwebengine \
              -skip qtwebview \
              -skip qtwinextras \
              -skip qtx11extras \
              -skip qtxmlpatterns \
              -make libs \
              -make examples \
              -nomake tools -nomake tests \
              -gui \
              -widgets \
              -dbus-runtime \
              --glib=no \
              --iconv=no \
              --pcre=qt \
              --zlib=qt \
              -no-openssl \
              --freetype=qt \
              --harfbuzz=qt \
              -no-opengl \
              -linuxfb \
              --xcb=no \
              -tslib \
              --libpng=qt \
              --libjpeg=qt \
              --sqlite=qt \
              -plugin-sql-sqlite \
              -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/ \
              -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/allwinner/ \
              -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/allwinner/include/ \
              -L/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/lib/ \
              -recheck-all
      

      几个关键的配置选项说明介绍一下

      • -xplatform linux-riscv64-gnu-g++:

      linux-riscv64-gnu-g++ 就是刚刚创建的配置文件夹里面有刚刚创建的qmake.conf qplatformdefs.h,指明了所使用的交叉编译工具链。

      • -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/
      • -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/allwinner/
      • -I/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/include/allwinner/include/

      指示说明库头文件的位置

      • -L/home/leesum/tina-d1-h/out/d1-h-nezha/staging_dir/target/usr/lib/

      说明库的位置

      • export PATH=$PATH:/home/leesum/tina-d1-h/prebuilt/gcc/linux-x86/riscv/toolchain-thead-glibc/riscv64-glibc-gcc-thead_20200702/bin/

      说明交叉编译工具链的位置

      位置参考自己Tina-SDK的下载目录

      为autoConfigure.sh添加可执行权限

      chmod +x autoConfigure.sh
      

      交叉编译QT5

      进入QT源码根目录,运行刚刚配置的环境。

      source ./autoConfigure.sh
      

      若配置成功会显示以下信息

      image-20220529224209489

      开始编译,具体核心数按照自己的配置指定,预留 8G 空间已足够使用。

      make -j2
      

      我按照以上配置一次编译成功,没有遇见错误。

      编译成功后执行

      make install
      

      安装目录在qt-everywhere-src-5.15.4/qtbase/bin/riscv-qt

      riscv-qt 就是刚刚配置文件中-prefix ./riscv-qt指定的目录。

      将该目录移动到DockRV开发板上,具体方法可以 tar 打包后通过 adb push 或者SFTP发送。

      测试examples

      进入QT5目录,创建环境配置文件 qt-path

      vi qt-path
      
      #内容如下
      echo begin
      export QT_HOME=/root/bin/riscv-qt
      export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
      export QT_QPA_FB_DRM=1
      export QT_QPA_GENERIC_PLUGINS=evdevkeyboard
      export QT_QPA_GENERIC_PLUGINS=evdevmouse
      export QT_QPA_EVDEV_MOUSE_PARAMETERS=/dev/input/event1
      export QT_QPA_EVDEV_KEYBOARD_PARAMETERS=/dev/input/event0
      export QT_PLUGIN_PATH=$QT_HOME/plugins
      export LD_LIBRARY_PATH=/lib:/usr/lib:/$QT_HOME/lib
      

      鼠标和键盘具体的 /dev/input/eventx 可以通过getevent获得

      image-20220529230516666

      激活QT运行环境

      source ./qt-path
      

      如果显示

      ./zoomlinechart: error while loading shared libraries: libQt5Charts.so.5: cannot open shared object file: No such file or directory
      

      检查 qt-path 的 LIB 配置

      进入 example 目录,运行自带例程

      cd examples/gui/analogclock
      chmod +x analogclock
      ./analogclock
      

      image-20220529231446060

      HDMI接口显示正常,并且鼠标能够正常移动,可自行测试其他example

      由于移植的QT5所有的绘制都是基于软件实现的,运行效果很卡,有好的解决方法可以相互交流。

      字体问题也有待解决

      image-20220529232317262

      解决QT5字体问题

      因为编译的源码库中没有自带fonts,所以不能显示文字。

      进入开发板QT5目录,在 lib 文件夹中创建 fonts 文件夹

      mkdir lib/fonts
      

      下载 TTF 字体文件 将字体放入刚刚创建的 fonts 文件夹中。
      adobe-fonts/source-sans: Sans serif font family for user interface environments (github.com)

      测试

      发布在 MR Series
      L
      leesum
    • 回复: 搭建了一个 Tina 的 opkg 仓库,软件包逐渐完善中

      1bdce207-64be-402c-82f8-494233e50d81-image.png
      ffmpeg 没有依赖

      发布在 MR Series
      L
      leesum
    • 回复: 搭建了一个 Tina 的 opkg 仓库,软件包逐渐完善中

      已经用上了,装上了nano,准备装ffmpeg,但是网络好像不太好,需要科学才能下载完成

      发布在 MR Series
      L
      leesum