去官网下载anzyelay@ubuntu:Desktop$ wget https://download.qt.io/archive/qt/5.6/5.6.0/single/qt-everywhere-opensource-src-5.6.0.tar.xz
anzyelay@ubuntu:Desktop$ tar -Jxf qt-everywhere-opensource-src-5.6.0.tar.xz
anzyelay@ubuntu:Desktop$ cd qt-everywhere-opensource-src-5.6.0
吐槽下在QT官网的文档查询入口我开始一直点Docment,找来找去还是那几个没什么用的,后来点了下WIKI才发现点东西:https://wiki.qt.io/Main,可这里都是旧版的,新版还是要跳转回去。真无言,也就找到了特定设备的粟子,针对device的configure例子,还好最终还是找到了一个比较详细有内容的配置说明,点我查看原文嫌麻烦的可看我文尾的简介。
在qt-everywhere-opensource-src-5.6.0下自建个可执行脚本autoconfig.sh内容如下, 可以自行按需修改
anzyelay@ubuntu:qt-everywhere-opensource-src-5.6.0$ cat autoconfig.sh
#!/bin/sh
./configure
-prefix /usr/local/Qt5.6-arm
-opensource
-confirm-license
-release -shared
-xplatform linux-arm-gnueabi-g++
-optimized-qmake
-pch
-qt-sql-sqlite
-qt-libjpeg
-qt-zlib
-qt-libpng
-qt-freetype
-tslib
-no-opengl
-no-sse2
-no-openssl
-no-nis
-no-cups
-no-glib
-no-dbus
-no-xcb
-no-eglfs
-no-xcursor -no-xfixes -no-xrandr -no-xrender
-no-separate-debug-info
-no-iconv
-make libs
-make examples
-nomake tools -nomake tests
-skip
-v
-skip qt3d -skip qtcanvas3d -skip qtdoc -skip qtwayland
exit
anzyelay@ubuntu:qt-everywhere-opensource-src-5.6.0$
执行后成功如下:
anzyelay@ubuntu:qt-everywhere-opensource-src-5.6.0$ ./autoconfig.sh
...省略...
Configure summary
Building on: linux-g++ (x86_64, CPU features: mmx sse sse2)
Building for: linux-arm-gnueabi-g++ (arm, CPU features: none detected)
Platform notes:
- Also available for Linux: linux-clang linux-kcc linux-icc linux-cxx
qmake vars .......... styles += mac fusion windows DEFINES += QT_NO_MTDEV DEFINES += QT_NO_LIBUDEV DEFINES += QT_NO_LIBINPUT sql-drivers= sqlite sql-plugins= qmake switches .........
Build options:
Configuration .......... accessibility audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent cross_compile enable_new_dtags evdev eventfd freetype full-config getaddrinfo getifaddrs harfbuzz inotify ipv6ifname large-config largefile linuxfb medium-configminimal-config mremap no-pkg-config pcre png posix_fallocate precompile_header qpa qpa reduce_exports release release_tools rpath shared small-config tslib zlib
Build parts ............ libs examples
Mode ................... release; optimized tools
Using sanitizer(s)......none
Using C++ standard ..... c++11
Using gold linker....... no
Using new DTAGS ........ yes
Using PCH .............. yes
Using LTCG ............. no
Target compiler supports:
Neon ................. no
Qt modules and options:
Qt D-Bus............... no
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 ............... qt
Glib ................... no
GStreamer .............. no
GTK theme .............. no
HarfBuzz ............... yes (bundled copy)
Iconv .................. no
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 .................... no
OpenGL / OpenVG:
EGL .................. no
OpenGL ............... no
OpenVG ............... no
PCRE ................... yes (bundled copy)
pkg-config............. no
PulseAudio ............. no
QPA backends:
DirectFB ............. no
EGLFS ................ no
EGLFS i.MX6 ........ no
EGLFS i.MX6 Wayland. no
EGLFS EGLDevice .... no
EGLFS GBM .......... no
EGLFS Mali ......... no
EGLFS Raspberry Pi . no
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 ............... qt-qt
TDS .................. no
tslib .................. yes
udev ................... no
xkbcommon-x11........... no
xkbcommon-evdev......... no
zlib ................... yes (bundled copy)
NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1.
Configure with'-qreal float'to create a build that is binary compatible with5.1.
NOTE: -optimized-tools is not useful in-release mode.
Info: creating super cache file /home/anzyelay/Desktop/arm/qt-everywhere-opensource-src-5.6.0/.qmake.super
Qt is now configured for building. Just run 'make'.
Once everything is built, you must run 'make install'.
Qt will be installed into /usr/local/Qt5.6-arm
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
4. 编译安装
make & sudo make install开始时由于没有加最后-skip一项.make时会遇到错误,就是关于3D插件部分编译失败,按网上的说法可以修改qt.pro,但5.6.0版的却不一样了,没有addmodule这样的语句,而是用for语句来加载“.gitmodules”这个文件里申明的模块,猜测应该可以直接在这个文件里把qtcanvas3d, qt3d , qtconnectivity, qtwayland 这几个模块注释掉,我没有这样做了,一开始是.configure后在生成的Makefile里直接修改SUBTARGETS的值,去掉“module-qt3d”之类的,如下图列举了一部分,你可以直接 寻到到上面说的几个不能编译的模块删了就行:30SUBTARGETS =
31module-qtbase32module-qtmacextras33module-qtx11extras34module-qtimageformats
我是这样编译成功的,后来看了下文档有更容易的方法,直接在配置时使用 -skip选项就行,具体说明见文尾说明。
5.拷贝库和插件到根文件系
安装后就在你prefix指定的目录下有了我需要拷贝的文件了。这里只需要拷贝一些动态库和插件目录,对,不要忘了在lib下还有个fonts文件夹也需要。
anzyelay@ubuntu:qt-everywhere-opensource-src-5.6.0$ ls /usr/local/Qt5.6-arm/
bin doc include lib mkspecs plugins qml translations
anzyelay@ubuntu:qt-everywhere-opensource-src-5.6.0$ cp -av /usr/local/Qt5.6-arm/lib/*so* /usr/local/Qt5.6-arm/lib/fonts /usr/local/Qt5.6-arm/plugins ~/Desktop/arm/myrootfs/usr/local/qt5/