QT交叉编译环境

* 主机环境推荐:Debian 10 x64 bit,

    
 本公司已配置好的QT编译环境 Docker image:

QT编译环境Docker

 ### load docker image 
 sudo docker load <nodka_docker_qt_build_20230223.tar
 
 ### 运行docker image,注意 : /home/APP_PATH为QT应用程序所在目录
 sudo docker run --rm --mount type=bind,source=/home/APP_PATH,target=/mnt/ -i -t 09a37c1b2fc3 /bin/bash 

 ###  编译QT 应用程序
 cd  /mnt
 qmake
 make

* 主机交叉编译环境配置参考步骤:

1. 安装交叉编译工具链:

  apt install -y crossbuild-essential-arm64
  

2. 拷贝平板系统内的/usr & /lib 到主机 /home/nodka/qt5/qt_sysroot 目录下

3. 配置以下环境变量

QTSYSROOT="/home/nodka/qt5/qt_sysroot"
QTPATH=$QTSYSROOT/usr/local/qt5.12-arm
  
LD_LIBRARY_PATH=$QTPATH/lib:$LIBRARY_PATH
LIBRARY_PATH=$QTPATH/lib:$LIBRARY_PATH
C_INCLUDE_PATH=$QTPATH/include:$C_INCLUDE_PATH
PATH=$QTPATH/bin:$PATH
  
PKG_CONFIG_PATH=$QTPATH/lib/pkgconfig:$PKG_CONFIG_PATH
  
export LD_LIBRARY_PATH
export LIBRARY_PATH
export C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH
  
export PKG_CONFIG_PATH
export PATH

4. 编译APP

qmake
make

QT Creator

1. 安装

进入Qt官方下载页面,选择一个版本下载 qt-creator-opensource-linux-x86_64-x.x.x.run,下载完成之后,在终端执行 ./xxxx.run 运行安装,注意文件需要有执行权限。

2.配置

安装完成后,启动 Qt Creator,打开菜单 Tools → Option ,找到Kits。

  • 配置 Qt Versions

点击右侧 add 按钮添加,选择 Qt 环境安装位置中的 qmake 即可

qmake:

/usr/local/qt5.12-arm/bin/qmake

  • 配置 Compilers

点击右侧 add 按钮添加 gcc 和 g++ 交叉编译器的位置

如果主机安装了 crossbuild-essential-arm64,则编译器就在 /usr/bin/ 下

如果使用了第三方的交叉编译器,找到安装位置并添加即可

如果目标平台是 Buildroot ,则需要使用 Buildroot Qt 环境包中的编译器

g++:/usr/bin/aarch64-linux-gnu-g++

gcc:/usr/bin/aarch64-linux-gnu-gcc

为方便调试,配置 Debeggers 和 Devices 用于在线调试:

  • 配置 Debuggers

点击右侧 add 按钮添加 gbd-multiarch: apt install -y gdb-multiarch

检查目标机上是否存在 /usr/bin/gdbserver, 没有的话需要安装:apt install -y gdbserver,没有的话需要安装:apt install -y gdbserver (Buildroot 自带,无需安装)

回到主机的 Qt Creator,点击右侧 add 按钮添加 gdb

选择主机中的 gdb-multiarch : /usr/bin/gdb-multierch

  • 配置 Devices

设置好设备的 IP 、用户名(root)。为了方便调试,可以在设备上设置静态 IP。

  • 配置Kits

将前面设置的配置项添加到 Kits。

如果目标平台是 Ubuntu 系统,这一步也需要添加 sysroot 的路径

高清硬解码

Docker

Docker English-Community 支持以下的 Ubuntu 版本:

  • Xenial 16.04(LTS)
  • Bionic 18.04(LTS)
  • Cosmic 18.04
  • Disco 19.04
  • 其他更新的版本…

安装命令如下:

curl -fsSL https://get.docker.com | bash -s docker --miror Aliyun

也可以使用国内 daocloud 一键安装命令:

curl -sSL https://get.daocloud.io/docker | sh

测试 Docker 是否安装成功,输入以下指令,打印出以下信息则安装成功:

sudo docker run hello-world

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete                                                                                                                                  
Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f
Status: Downloaded newer image for hello-world:latest


Hello from Docker!
This message shows that your installation appears to be working correctly.


To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.


To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash


Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/


For more examples and ideas, visit:
 https://docs.docker.com/get-started/

OpenCL

  • 系统已经支持OpenCL,输入命令clinfo即可查看支持详情:

打印/导出