arm平台:BeagleBone Black
编译平台:ubuntu16.04
交叉编译工具:arm-linux-gnueabihf
qt源码:qt-everywhere-opensource-src-5.8.0.tar.gz
设置arm-linux-gnueabihf路径
~$ vim ~/.bashrc
向文件中加入如下一行
export PATH=$PATH:~/gcc-linaro-4.9-arm-linux-gnueabihf/bin
保存并退出文件,刷新
~$ source ~/.bashrc
配置并编译qt
修改qt支持arm-linux-gnueabihf交叉编译工具
~$ tar -xzf qt-everywhere-opensource-src-5.8.0.tar.gz
~$ cd qt-everywhere-opensource-src-5.8.0/qtbase/mkspecs
~/qt-everywhere-opensource-src-5.8.0/qtbase/mkspecs$ cp -r linux-arm-gnueabi-g++/ linux-arm-gnueabihf-g++
~/qt-everywhere-opensource-src-5.8.0/qtbase/mkspecs/linux-arm-gnueabihf-g++$ vim qmake.conf
把文件中的arm-linux-gnueabi替换为arm-linux-gnueabihf,如下内容
#
# qmake configuration for building with arm-linux-gnueabihf-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)
# modifications to g++.conf
QMAKE_CC = arm-linux-gnueabihf-gcc
QMAKE_CXX = arm-linux-gnueabihf-g++
QMAKE_LINK = arm-linux-gnueabihf-g++
QMAKE_LINK_SHLIB = arm-linux-gnueabihf-g++
# modifications to linux.conf
QMAKE_AR = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY = arm-linux-gnueabihf-objcopy
QMAKE_NM = arm-linux-gnueabihf-nm -P
QMAKE_STRIP = arm-linux-gnueabihf-strip
load(qt_config)
配置qt
~/qt-everywhere-opensource-src-5.8.0/qtbase/mkspecs/linux-arm-gnueabihf-g++$ cd ~/qt-everywhere-opensource-src-5.8.0
~/qt-everywhere-opensource-src-5.8.0$ ./configure -prefix $PWD/qtbase -opensource -xplatform linux-arm-gnueabihf-g++ -no-opengl -nomake examples
编译qt
~/qt-everywhere-opensource-src-5.8.0$ make -j4
编译完成后在Qt Creator内设置qmake路径,就可以使用了