Qt5.9.6ARM平台移植交叉编译
前⾔
⽬前⼤多数开发板⾃带Qt环境,但是版本较为落后,多数都为Qt4.8的版本,都9102年了,已经⽆法满⾜现在的开发需求,所以现在记录⼀下Qt5.9.6的交叉编译。⼀⽅⾯是为了⾃⼰⼤学的学习的积累和总结,另⼀⽅⾯也是为了刚接触嵌⼊式开发的⼩⽩不要像我⼀样在移植时到处碰壁。
Here we go !
编译前准备⼯作
1. 平台及资源
主机环境:ubuntu 14.04
开发板 :⽶尔科技 ARM 335X 系列
Qt:qt-everywhere-opensource-src-5.9. 建议下载源码压缩包,run后缀的安装包⽂件⽐较⼤,⽽且不⽅便交叉编译。
编译器:arm-linux-gnueabihf 交叉编译器最好选择开发板⼚商提供的交叉编译⼯具链 (Qt5.9 所需的编译器版本必须是4.8版本以上)
2. 交叉编译器配置环境变量
在~/.profile中添加环境变量指定到交叉编译器的bin⽬录下,例如:
export PATH=$PATH:/home/linux/work/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin
并执⾏ source ~/.profile 使配置⽣效
使⽤ arm-linux-gnueabihf-gcc -v 命令查看当前版本号,同时检查环境变量配置是否⽣效。
OK !如果成功打印出了版本号,说明第⼀步已经完成。接下来就可以开始移植⼀系列的软件了,此处
和Qt⼀同编译的还有触摸屏所需tslib和数据库SQLite3,这两个已经完成交叉编译了,详情可以查看我的前两篇博客。
开始Qt的编译
1. 修改f⽂件
Qt5⽀持相当多嵌⼊式平台的移植,针对每⼀种平台都有相应的配置⽂件夹,只需修改你想要移植的⽬标平台对应的⽂件夹,再在之后的./configure脚本指定你想要编译的⽂件夹即可完成对应的移植。
进⼊qt-everywhere-opensource-src-5.9.6⽂件夹
打开 /qtbase/mkspecs/linux-arm-gnueabi-g++/f⽂件
将 “=” 号 右边的编译器替换为⾃⼰的交叉编译器(即刚刚配置过环境变量的编译器,根据⾃⾝情况修改)。若未配置环境变量则需要在编译器前加上路径。
同时QMAKE_INCDIR 指定为交叉编译完成的tslib和sqlite的头⽂件路径(空格分隔)
QMAKE_LIBDIR指定为交叉编译完成后的tslib和sqlite的库⽂件路径
2. 运⾏configure脚本
./configure 执⾏脚本添加参数,这⾥使⽤了⼀个脚本来配置configure,以便于了解参数和⽇后查看。
./configure \
-v \
##指定编译出来的⽂件路径
-prefix /home/zzl/arm2/qt5.9.6 \
-confirm-license \
-opensource \
-shared \
-
release  \
-make libs \
##指定⽬标编译平台(实质上是指定/qtbase/mkspecs下的⽂件夹)
-xplatform linux-arm-gnueabi-g++ \
-optimized-qmake \
-pch \
-linuxfb \
-qt-libjpeg \
-qt-libpng \
##集成sqlite环境
-sqlite \
-
qt-zlib \
##不编译集成⼀下模块(更具⾃⾝需求决定)
-no-opengl \
-no-sse2 \
-no-openssl \
-no-cups \
-no-separate-debug-info \
##去掉不必要的样例和⼯具减少编译时间
-nomake examples -nomake tools -nomake tests -no-iconv \
##集成tslib环境
-tslib \
##指定tslib头⽂件以及⽬录
-I/home/zzl/arm2/tslib/include \
-L/home/zzl/arm2/tslib/lib \
-recheck-all
configure脚本运⾏过后会打印 组建信息,我保存了下来以供参考
Building on: linux-g++ (x86_64, CPU features: mmx sse sse2)
Building for: linux-arm-gnueabi-g++ (arm, CPU features: <none>)
Configuration: cross_compile compile_examples enable_new_dtags largefile precompile_header shared rpath release c++11 c++14 c++1z concurrent dbu s no-pkg-config reduce_exports release_tools stl
Build options:
Mode ................................... release; optimized tools
Optimize release build for size ........ no
Building shared libraries .............. yes
Using C++ standard ..................... C++1z
mysql下载选x86还是armUsing ccache ........................... no
Using gold linker ...................... no
Using new DTAGS ........................ yes
Using precompiled headers .............. yes
Using LTCG ............................. no
Target compiler supports:
NEON ................................. no
Build parts ............................ libs
Qt modules and options:
Qt Concurrent .......................... yes
Qt D-Bus ............................... yes
Qt D-Bus directly linked to libdbus .... no
Qt Gui ................................. yes
Qt Network ............................. yes
Qt Sql ................................. yes
Qt Testlib ............................. yes
Qt Widgets ............................. yes
Qt Xml ................................. yes
Support enabled for:
QML debugging .......................... yes
udev ................................... no
Using system zlib ...................... no
Qt Core:
DoubleConversion ....................... yes
Using system DoubleConversion ........ no  GLib ................................... no
iconv .................................. no
ICU .................................... no
Logging backends:
journald ............................. no
syslog ............................... no
slog2 ................................ no
Using system PCRE2 ..................... no
Qt Network:
getaddrinfo() .......................... yes
getifaddrs() ........................... yes
IPv6 ifname ............................ yes
libproxy ............................... no
OpenSSL ................................ no
Qt directly linked to OpenSSL ........ no
SCTP ................................... no
Use system proxies ..................... yes
Qt Gui:
Accessibility .......................... yes
FreeType ............................... yes
Using system FreeType ................ no
HarfBuzz ............................... yes
Using system HarfBuzz ................ no
Fontconfig ............................. no
Image formats:
GIF .................................. yes
ICO .................................. yes
JPEG ................................. yes
Using system libjpeg ............... no
PNG .................................. yes
Using system libpng ................ no
EGL .................................... no
OpenVG ................................. no
OpenGL:
Desktop OpenGL ....................... no
OpenGL ES 2.0 ........................ no
OpenGL ES 3.0 ........................ no
OpenGL ES 3.1 ........................ no
Session Management ..................... yes Features used by QPA backends:
evdev .................................. yes
libinput ............................... no
INTEGRITY HID .......................... no
mtdev .................................. no
tslib .................................. yes
xkbcommon-evdev ........................ no QPA backends:
DirectFB ............................... no
EGLFS .................................. no
LinuxFB ................................ yes
VNC .................................... yes
Mir client ............................. no
Qt Widgets:
GTK+ ................................... no
Styles ................................. Fusion Windows Qt PrintSupport:
CUPS ................................... no
Qt Sql:
InterBase .............................. no
MySql .................................. no
OCI (Oracle) ........................... no
ODBC ................................... no
PostgreSQL ............................. no
SQLite2 ................................ no
SQLite ................................. yes
Using system provided SQLite ......... yes
TDS (Sybase) ........................... no
Qt SerialBus:
Socket CAN ............................. yes
Socket CAN FD .......................... yes QtXmlPatterns:
XML schema support ..................... yes
Qt QML:
QML interpreter ........................ yes
QML network support .................... yes
Qt Quick:
Direct3D 12 ............................ no
AnimatedImage item ..................... yes
Canvas item ............................ yes
Support for Qt Quick Designer .......... yes
Flipable item .......................... yes
GridView item .......................... yes
ListView item .......................... yes
Path support ........................... yes
PathView item .......................... yes
Positioner items ....................... yes
ShaderEffect item ...................... yes
Sprite item ............................ yes
Qt Gamepad:
SDL2 ................................... no
Qt 3D:
Assimp ................................. yes
System Assimp .......................... no
Output Qt3D Job traces ................. no
Output Qt3D GL traces .................. no
Qt 3D GeometryLoaders:
Autodesk FBX ........................... no
Qt Wayland Client ........................ no
Qt Wayland Compositor .................... no
Qt Bluetooth:
BlueZ .................................. no
BlueZ Low Energy ....................... no
Linux Crypto API ....................... no
Qt Sensors:
sensorfw ............................... no
Qt Quick Controls 2:
Styles ................................. Default Material Universal Qt Quick Templates 2:
Hover support .......................... yes
Multi-touch support .................... yes
Qt Positioning:
Gypsy GPS Daemon ....................... no
WinRT Geolocation API .................. no
Qt Location:
Geoservice plugins:
OpenStreetMap ........................ yes
HERE ................................. yes
Esri ................................. yes
Mapbox ............................... yes
MapboxGL ............................. no
Itemsoverlay ......................... yes
Qt Multimedia:

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。