“模板:Qt使用方法”的版本间的差异
来自ARM Wiki
Tangdapeng(讨论 | 贡献) |
Tangdapeng(讨论 | 贡献) (→使用源码编译) |
||
(未显示同一用户的28个中间版本) | |||
第1行: | 第1行: | ||
− | ==Qt 版本支持情况== | + | =='''Qt 版本支持情况'''== |
目前各平台支持的Qt版本如下: | 目前各平台支持的Qt版本如下: | ||
{| class="wikitable" | {| class="wikitable" | ||
第13行: | 第13行: | ||
| BuildRoot | | BuildRoot | ||
|- | |- | ||
− | | | + | | i.Mx6 |
− | |||
− | |||
− | |||
| | | | ||
+ | | Qt 5.5.1 | ||
| | | | ||
| | | | ||
+ | | Qt 5.2.1 | ||
| | | | ||
+ | | Qt 5.6.2 | ||
| | | | ||
|- | |- | ||
− | | | + | | i.Mx8 |
| | | | ||
| | | | ||
第30行: | 第30行: | ||
| | | | ||
| | | | ||
+ | | Qt 5.12.3 | ||
| | | | ||
+ | |- | ||
+ | | RK3288 | ||
| | | | ||
− | |||
− | |||
| | | | ||
| | | | ||
| | | | ||
| | | | ||
− | |||
| | | | ||
− | |||
| | | | ||
+ | | Qt 5.9.4 | ||
|- | |- | ||
− | | | + | | RK3399 |
− | |||
| | | | ||
| | | | ||
第52行: | 第51行: | ||
| | | | ||
| | | | ||
+ | | Qt 5.9.4 | ||
|- | |- | ||
| RK1808 | | RK1808 | ||
第61行: | 第61行: | ||
| | | | ||
| | | | ||
− | | | + | | Qt 5.12.2 |
|} | |} | ||
+ | |||
+ | ==Linux搭建Qt== | ||
+ | ===Debian、Ubuntu=== | ||
+ | ====使用apt从官方源中获取==== | ||
+ | *Qt5安装 | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo apt-get update | ||
+ | sudo apt-get install qt5-default | ||
+ | sudo apt-get install qtcreator | ||
+ | </syntaxhighlight> | ||
+ | *Qt4安装 | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo apt-get install build-essential | ||
+ | sudo apt-get install qt4-dev-tools qt4-doc qt4-qtconfig qt4-demos qt4-designer qtcreator | ||
+ | </syntaxhighlight> | ||
+ | ====使用源码编译==== | ||
+ | *不建议自行编译,可能会有编译报错、运行报错的问题 | ||
+ | *以下是示例方法 | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | wget http://mirror.bit.edu.cn/qtproject/archive/qt/5.9/5.9.3/single/qt-everywhere-opensource-src-5.9.3.tar.xz | ||
+ | xz -d qt-everywhere-opensource-src-5.9.3.tar.xz | ||
+ | tar xvf qt-everywhere-opensource-src-5.9.3.tar | ||
+ | ./configure -confirm-license -opensource -release -make libs -linuxfb -xcb -pch -platform linux-aarch64-gnu-g++ -make examples -nomake tools -nomake tests -prefix /usr/lib/aarch64-linux-gnu/qt5 | ||
+ | #configure选项需要根据平台、系统进行相应的配置 | ||
+ | make -j4 | ||
+ | make install | ||
+ | </syntaxhighlight> | ||
+ | *安装路径为-prefix参数后面的文件路径,还需要配置环境变量 | ||
+ | |||
+ | ===Yocto、Buildroot=== | ||
+ | :系统中已经内建Qt,支持的版本如上[[#Qt 版本支持情况|支持版本]] | ||
+ | *[[Buildroot系统qt使用方法]] | ||
+ | *[[Yocto系统qt使用方法]] | ||
+ | |||
+ | ==运行Demo== | ||
+ | |||
+ | |||
+ | |||
+ | <!-- | ||
+ | ==PC端开发环境搭建== | ||
+ | *主机环境:Ubuntu 16.04 | ||
+ | *开发板平台:RK3399 Debian9 | ||
+ | ===配置编译环境=== | ||
+ | *下载源码及交叉编译工具 | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | wget https://releases.linaro.org/components/toolchain/binaries/6.3-2017.05/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz | ||
+ | xz -d gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz | ||
+ | tar -xvf gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar | ||
+ | </syntaxhighlight> | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | wget http://download.qt.io/archive/qt/5.9/5.9.4/single/qt-everywhere-opensource-src-5.9.4.tar.xz | ||
+ | xz -d qt-everywhere-opensource-src-5.9.4.tar.xz | ||
+ | tar -xvf qt-everywhere-opensource-src-5.9.4.tar | ||
+ | </syntaxhighlight> | ||
+ | *配置交叉工具链 | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | export ARCH=arm64 | ||
+ | export CC_PATH=/home/work/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin #交叉编译链路径 | ||
+ | export CROSS_COMPILE=${CC_PATH}/aarch64-linux-gnu- | ||
+ | export PATH=${PATH}:${CC_PATH} | ||
+ | </syntaxhighlight> | ||
+ | *查看支持的硬件平台 | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | ls qt-everywhere-opensource-src-5.9.4/qtbase/mkspecs/ | ||
+ | </syntaxhighlight> | ||
+ | *配置qmake.conf,修改如下(路径qt-everywhere-opensource-src-5.9.4/qtbase/mkspecs/linux-aarch64-gnu-g++/qmake.conf) | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | # | ||
+ | # qmake configuration for building with aarch64-linux-gnu-g++ | ||
+ | # | ||
+ | |||
+ | MAKEFILE_GENERATOR = UNIX | ||
+ | CONFIG += incremental | ||
+ | QMAKE_INCREMENTAL_STYLE = sublib | ||
+ | |||
+ | QT_QPA_DEFAULT_PLATFORM = linux #eglfs | ||
+ | |||
+ | include(../common/linux.conf) | ||
+ | include(../common/gcc-base-unix.conf) | ||
+ | include(../common/g++-unix.conf) | ||
+ | |||
+ | # modifications to g++.conf | ||
+ | QMAKE_CC = /opt/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc #填写工具链的绝对路径,下同 | ||
+ | QMAKE_CXX = /opt/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ | ||
+ | QMAKE_LINK = /opt/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ | ||
+ | QMAKE_LINK_SHLIB = /opt/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ | ||
+ | |||
+ | # modifications to linux.conf | ||
+ | QMAKE_AR = /opt/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ar cqs | ||
+ | QMAKE_OBJCOPY = /opt/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-objcopy | ||
+ | QMAKE_NM = /opt/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-nm -P | ||
+ | QMAKE_STRIP = /opt/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-strip | ||
+ | load(qt_config) | ||
+ | </syntaxhighlight> | ||
+ | *配置configure,需要编译的库 | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | ./configure -v -prefix /home/me/work-note/linux_app/qt5.9.4 -release -opensource -no-accessibility -xplatform linux-aarch64-gnu-g++ -optimized-qmake -pch -make tools -no-gif -no-glib -no-opengl -no-sse2 -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 -no-avx -make examples -no-pkg-config -no-separate-debug-info | ||
+ | </syntaxhighlight> | ||
+ | *编译安装Qt | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | make && make install | ||
+ | </syntaxhighlight> | ||
+ | ===配置板端运行环境=== | ||
+ | *进入PC端Qt的安装路径,将文件拷贝到开发板上 | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | export LD_LIBRARY_PATH=/userdata/qt5.9.4/lib:$LD_LIBRARY_PATH #开发板上Qt路径 | ||
+ | export QT_QPA_PLATFORM_PLUGIN_PATH=/userdata/qt5.9.4/plugins | ||
+ | export QT_QPA_PLATFORM=linuxfb | ||
+ | </syntaxhighlight> | ||
+ | *根据实际情况配置运行环境库 | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | export QT_QPA_FONTDIR= #指定qt字体库 | ||
+ | export QT_QPA_PLATFORM_PLUGIN_PATH= #指定qt下的插件 | ||
+ | export LD_LIBRARY_PATH= #指定qt动态库 | ||
+ | export QT_QPA_PLATFORM= #指定屏幕设备文件 | ||
+ | </syntaxhighlight> | ||
+ | --> |
2020年6月28日 (日) 11:07的最新版本
目录
Qt 版本支持情况
目前各平台支持的Qt版本如下:
CPU | Debian 7 | Debian 8 | Debian 9 | Ubuntu12.04 | Ubuntu14.04 | Ubuntu16.04 | Yocto | BuildRoot |
i.Mx6 | Qt 5.5.1 | Qt 5.2.1 | Qt 5.6.2 | |||||
i.Mx8 | Qt 5.12.3 | |||||||
RK3288 | Qt 5.9.4 | |||||||
RK3399 | Qt 5.9.4 | |||||||
RK1808 | Qt 5.12.2 |
Linux搭建Qt
Debian、Ubuntu
使用apt从官方源中获取
- Qt5安装
sudo apt-get update
sudo apt-get install qt5-default
sudo apt-get install qtcreator
- Qt4安装
sudo apt-get install build-essential
sudo apt-get install qt4-dev-tools qt4-doc qt4-qtconfig qt4-demos qt4-designer qtcreator
使用源码编译
- 不建议自行编译,可能会有编译报错、运行报错的问题
- 以下是示例方法
wget http://mirror.bit.edu.cn/qtproject/archive/qt/5.9/5.9.3/single/qt-everywhere-opensource-src-5.9.3.tar.xz
xz -d qt-everywhere-opensource-src-5.9.3.tar.xz
tar xvf qt-everywhere-opensource-src-5.9.3.tar
./configure -confirm-license -opensource -release -make libs -linuxfb -xcb -pch -platform linux-aarch64-gnu-g++ -make examples -nomake tools -nomake tests -prefix /usr/lib/aarch64-linux-gnu/qt5
#configure选项需要根据平台、系统进行相应的配置
make -j4
make install
- 安装路径为-prefix参数后面的文件路径,还需要配置环境变量
Yocto、Buildroot
- 系统中已经内建Qt,支持的版本如上支持版本