编译arm版qt库 5.8.0

转载地址:http://blog.youkuaiyun.com/elikang/article/details/53140635

来自QQ群 Linux && 技术分享 311078264

此文档由elikang整理,为了文章简单直接,许多细节未能在文章中体现,如有疑问请进群讨论。



准备,安装编译器:
安装arm-linux-gnueabihf-gcc:
$ sudo apt install gcc-arm-linux-gnueabi
$ sudo apt install g++-arm-linux-gnueabi
$ sudo apt install gcc-arm-linux-gnueabihf
(或者使用 arm-none-linux-gnueabi-gcc ,qmake.conf需要同步进行更改。)


第一步:
下载qt-everywhere-opensource-src-5.8.0.tar.gz,这个Qt官方有,下载需要确认license。

第二步:
找个英文目录,把qt-everywhere-opensource-src-5.8.0.tar.gz放进去。
用终端解压:tar -zxvf qt-everywhere-opensource-src-5.8.0.tar.gz
最好别右击“提取到此处”,这个解压好像和命令解压不同。

第三步:
修改编译配置文件:
vim qt-everywhere-opensource-src-5.8.0/qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf
(注意我的改动)
#
# qmake configuration for building with arm-linux-gnueabi-g++
#

MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib

include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)


QT_QPA_DEFAULT_PLATFORM = linux #eglfs
QMAKE_CFLAGS += -O2 -march=armv7-a
QMAKE_CXXFLAGS += -O2 -march=armv7-a


# modifications to g++.conf
QMAKE_CC = arm-linux-gnueabi-gcc
QMAKE_CXX = arm-linux-gnueabi-g++
QMAKE_LINK = arm-linux-gnueabi-g++
QMAKE_LINK_SHLIB = arm-linux-gnueabi-g++


# modifications to linux.conf
QMAKE_AR = arm-linux-gnueabi-ar cqs
QMAKE_OBJCOPY = arm-linux-gnueabi-objcopy
QMAKE_NM = arm-linux-gnueabi-nm -P
QMAKE_STRIP = arm-linux-gnueabi-strip

load(qt_config)


注意:
这里指定了编译arm版qt所使用的编译器,与后期QtCreator项目的编译器是一样的。
如果你是用的是arm-none-linux-gnueabi-gcc,那么每一项都需要修改为arm-none-linux-gnueabi-*。


#这里提前解释一下,第三步中已经指定好了编译器版本,所以第四步不需要指定了。
#第四步中的-xplatform linux-arm-gnueabi-g++是对应qmake.conf所在的文件夹,代表了编译的Qt库的版本。


第四步:
配置编译参数,用./configre -help 可以查看参数。
我的配置是(去除掉了一些用不到的选项):
./configure -release -opensource -confirm-license -xplatform linux-arm-gnueabi-g++ -prefix /usr/local/qt5.8-nomake examples -no-opengl -no-iconv -silent -qpa linuxfb -no-gtk -qt-libjpeg -qt-libpng

注意:
1、-xplatform linux-arm-gnueabi-g++ ,指定了编译Arm版的QT库;
2、-prefix后面的配置为qt库需要安装的位置,这个需要根据你的安装位置自己指定。

第五步:
如果上面配置没有问题,接下来make:
$make
或者
$make -j2 /*CPU 几个核可以使用“-j几”,核多编的快*/

第六步:
安装:$sudo make install
在这里加sudo是因为,安装时会将库文件复制到上面第四步配置的安装目录( /usr/local/qt5.8)。
usr目录是需要root权限的。
   
好了,这是编译Qt5.8.0的过程。


编译平台插件:
由于Qt5以后,删除了嵌入式的QWS(Qt windows system-Qt窗体系统)换成QPA(Qt Platform Abstration -Qt平台抽象),平台插件在qt-everywhere-opensource-src-5.8.0/qtbase/src/plugins/platforms/下面。
有各种平台的插件,基于frambuffer的插件是lunuxfb这个文件夹下,其他的还有android、ios、winrt、windows等等,需要什么平台的编译就是了。
Building on: linux-g++ (x86_64, CPU features: mmx sse sse2) Building for: linux-aarch64-gnu-g++ (arm64, CPU features: neon) Target compiler: gcc 6.3.1 Configuration: cross_compile use_gold_linker compile_examples enable_new_dtags largefile neon precompile_header shared rpath release c++11 c++14 concurrent dbus reduce_exports stl Build options: Mode ................................... release Optimize release build for size ........ no Building shared libraries .............. yes Using C standard ....................... C11 Using C++ standard ..................... C++14 Using ccache ........................... no Using gold linker ...................... yes Using new DTAGS ........................ yes Using precompiled headers .............. yes Using LTCG ............................. no Target compiler supports: NEON ................................. yes 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: Using pkg-config ....................... yes udev ................................... no Using system zlib ...................... yes Qt Core: DoubleConversion ....................... yes Using system DoubleConversion ........ no GLib ................................... no iconv .................................. yes ICU .................................... no Tracing backend ........................ Logging backends: journald ............................. no syslog ............................... no slog2 ................................ no Using system PCRE2 ..................... no Qt Network: getifaddrs() ........................... yes IPv6 ifname ............................ yes libproxy ............................... no Linux AF_NETLINK ....................... yes OpenSSL ................................ yes Qt directly linked to OpenSSL ........ no OpenSSL 1.1 ............................ no DTLS ................................... yes 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 ............... yes 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 OpenGL ES 3.2 ........................ no Vulkan ................................. no Session Management ..................... yes Features used by QPA backends: evdev .................................. yes libinput ............................... no INTEGRITY HID .......................... no mtdev .................................. no tslib .................................. no xkbcommon .............................. no X11 specific: XLib ................................. no EGL on X11 ........................... no QPA backends: DirectFB ............................... no EGLFS .................................. no LinuxFB ................................ yes VNC .................................... yes Mir client ............................. no Qt Sql: SQL item models ........................ yes Qt Widgets: GTK+ ................................... no Styles ................................. Fusion Windows Qt PrintSupport: CUPS ................................... no Qt Sql Drivers: DB2 (IBM) .............................. no InterBase .............................. no MySql .................................. no OCI (Oracle) ........................... no ODBC ................................... no PostgreSQL ............................. no SQLite2 ................................ no SQLite ................................. yes Using system provided SQLite ......... no TDS (Sybase) ........................... no Qt Testlib: Tester for item models ................. yes Qt SerialBus: Socket CAN ............................. yes Socket CAN FD .......................... yes Qt QML: QML network support .................... yes QML debugging and profiling support .... yes QML sequence object .................... yes QML list model ......................... yes QML XML http request ................... yes QML Locale ............................. yes QML delegate model ..................... 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 TableView item ......................... yes Path support ........................... yes PathView item .......................... yes Positioner items ....................... yes Repeater item .......................... yes ShaderEffect item ...................... yes Sprite item ............................ yes Qt Scxml: ECMAScript data model for QtScxml ...... yes Qt Gamepad: SDL2 ................................... no Qt 3D: Assimp ................................. yes System Assimp .......................... no Output Qt3D Job traces ................. no Output Qt3D GL traces .................. no Use SSE2 instructions .................. no Use AVX2 instructions .................. no Aspects: Render aspect ........................ yes Input aspect ......................... yes Logic aspect ......................... yes Animation aspect ..................... yes Extras aspect ........................ yes Qt 3D Renderers: OpenGL Renderer ........................ yes 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 WinRT Bluetooth API (desktop & UWP) .... no Qt Sensors: sensorfw ............................... no Qt Quick Controls 2: Styles ................................. Default Fusion Imagine 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: Qt.labs.location experimental QML plugin . yes Geoservice plugins: OpenStreetMap ........................ yes HERE ................................. yes Esri ................................. yes Mapbox ............................... yes MapboxGL ............................. no Itemsoverlay ......................... yes QtXmlPatterns: XML schema support ..................... yes Qt Multimedia: ALSA ................................... no GStreamer 1.0 .......................... no GStreamer 0.10 ......................... no Video for Linux ........................ yes OpenAL ................................. no PulseAudio ............................. no Resource Policy (libresourceqt5) ....... no Windows Audio Services ................. no DirectShow ............................. no Windows Media Foundation ............... no Qt Tools: QDoc ................................... no Qt WebEngine: Embedded build ......................... yes Pepper Plugins ......................... no Printing and PDF ....................... no Proprietary Codecs ..................... no Spellchecker ........................... yes Native Spellchecker .................... no WebRTC ................................. no Use System Ninja ....................... no Geolocation ............................ yes WebChannel support ..................... yes Use v8 snapshot ........................ yes Kerberos Authentication ................ no Building v8 snapshot supported ......... yes Use ALSA ............................... no Use PulseAudio ......................... no Optional system libraries used: re2 .................................. no icu .................................. no libwebp, libwebpmux and libwebpdemux . no opus ................................. no ffmpeg ............................... no libvpx ............................... no snappy ............................... no glib ................................. no zlib ................................. yes minizip .............................. no libevent ............................. no jsoncpp .............................. no protobuf ............................. no libxml2 and libxslt .................. no lcms2 ................................ no png .................................. no JPEG ................................. no harfbuzz ............................. no freetype ............................. no x11 .................................. no Required system libraries: fontconfig ........................... no dbus ................................. no nss .................................. no khr .................................. no glibc ................................ yes Required system libraries for qpa-xcb: libdrm ............................... no xcomposite ........................... no xcursor .............................. no xi ................................... no xrandr ............................... no xtst ................................. no Note: Also available for Linux: linux-clang linux-icc
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值