编译器为openwrt_widora.tar.gz编译所得,后面给出编译所得文件。
gcc为:mipsel-openwrt-linux-gcc
g++为: mipsel-openwrt-linux-g++
1、测试环境为Ubuntu14.04 x64,建议在该环境中编译和使用。
2、下载qt-everywhere-opensource-src-5.8.0.tar.gz源码包,参考地址为http://download.qt.io/archive/qt/5.8/5.8.0/single/qt-everywhere-opensource-src-5.8.0.tar.gz.mirrorlist,搜索源码包名称会出现下载地址。
3、解压后,在qtbase/mkspecs中增加linux-mips-g++文件夹,可以拷贝linux-arm-gnueabi-g++文件夹中的文件,修改qmake.conf文件,如下:
#
# qmake configuration for building with mipsel-openwrt-linux-g++
#
MAKEFILE_GENERATOR = UNIX
TARGET_PLATFORM = unix
TEMPLATE = app
CONFIG += qt warn_on release incremental link_prl gdb_dwarf_index
QT += core gui
QMAKE_INCREMENTAL_STYLE = sublib
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
QMAKE_CC = mipsel-openwrt-linux-gcc
QMAKE_CXX = mipsel-openwrt-linux-g++
QMAKE_CFLAGS += -EL -mips32r2 -msoft-float
QMAKE_CXXFLAGS += -EL -mips32r2 -msoft-float
QMAKE_LINK = mipsel-openwrt-linux-g++ -EL -mips32r2 -msoft-float -lrt
QMAKE_LINK_SHLIB = mipsel-openwrt-linux-g++ -EL -mips32r2 -msoft-float -lrt
QMAKE_AR = mipsel-openwrt-linux-ar cqs
QMAKE_OBJCOPY = mipsel-openwrt-linux-objcopy
QMAKE_STRIP = mipsel-openwrt-linux-strip
load(qt_config)
4、然后在qt5.8当前目前下运行配置参数,完成后make,make install:
./configure -v -prefix ./qt5.8 -xplatform linux-mips-g++ -confirm-license -release -opensource -nomake tests -nomake examples -no-eglfs -no-openssl -no-qml-debug -no-optimized-tools -no-opengl
编译完成后会在qtbase目录下生成qt5.8目录。里面的bin/qmake就可以用来编译mips下的程序了,遇到错误的问题,可以尝试新建一个Ubuntu14.04 x64系统,该系统测试可以编译通过。
以下给出编译器和编译生成的文件,可以直接在Ubuntu14.04 x64系统中使用。
github下载链接 https://github.com/faststone/CrossCompile.git
链接:https://pan.baidu.com/s/19h94KLPgjrLr5-4gMbagVw
提取码:zioc
qt5.8_mipsel_ubuntu14.04_x64_dynamic.tar.gz为编译所得文件,将该文件和mkspecs.zip解压到/home/u/Downloads/qt-everywhere-opensource-src-5.8.0/qtbase/文件夹中。因为我的用户名为u,解压到~/Downloads/qt-everywhere-opensource-src-5.8.0/qtbase/应该也可以,尚未验证,链接失效或有问题可以在下面给我留言。