1.下载并解压源码
此处使用的源码版本是qt-everywhere-opensource-src-5.5.1
2.配置交叉工具
2.1新建/home/ubuntu/Downloads/qt-everywhere-opensource-src-5.5.1/qtbase/mkspecs/linux-mips64el-g++文件夹
拷贝qmake.conf qplatformdefs.h到此文件夹并修改qmake.conf (此处拷贝的是linux-arm-gnueabi-g++目录下的)
2.2修改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)
# modifications to g++.conf
QMAKE_CC = /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-gcc
QMAKE_CXX = /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-g++
QMAKE_LINK = /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-g++
QMAKE_LINK_SHLIB = /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-g++
# modifications to linux.conf
QMAKE_AR = /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-ar cqs
QMAKE_OBJCOPY = /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-objcopy
QMAKE_NM = /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-nm -P
QMAKE_STRIP = /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-strip
load(qt_config)
3.配置QT
sudo ./configure -v -confirm-license -prefix /opt/Qt_mips -opensource -accessibility -make libs -xplatform linux-mips64el-g++ -pch
有不少错误,应该是库的问题
4.编译sudo make
5.安装 sudo make install
6.移植编译好的qt到开发板
直接打包opt/Qt_mips到开发板opt下解压保持路径相同
7.配置开发板QT环境
打开etc/profile,在文件后面添加
export QT_ROOT=/opt/Qt_mips
export QT_QPA_FONTDIR=/opt/Qt_mips/lib/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export QT_PLUGIN_PATH=$QT_ROOT/plugins
export LD_LIBRARY_PATH=$QT_ROOT/lib:$QT_ROOT/plugins/platforms
8.运行简单的QT程序
9.解决
QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed
QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed
下载libiconv-1.15.tar.gz 路径Index of /gnu/libiconv
9.1./configure -prefix=/opt/libconv1.15 -host=mips64el-linux
9.2make
9.3make insatll
9.4移植到开发板并配置
cp preloadable_libiconv.so /usr/lib
/etc/profile最后一行添加
export LD_PRELOAD=/usr/lib/preloadable_libiconv.so
source /etc/profile
重新启动qt程序后无报错
10. QT5.12.11交叉编译配置 sudo ./configure -v -confirm-license -prefix /opt/Qt_mips5.12.11 -opensource -accessibility -make libs -xplatform linux-mips64el-g++ -pch -no-opengl
opengl安装有问题
拷贝开发板配置环境
export QT_ROOT=/opt/Qt_mips
export QT_QPA_FONTDIR=/opt/Qt_mips/lib/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export QT_PLUGIN_PATH=$QT_ROOT/plugins
export LD_LIBRARY_PATH=$QT_ROOT/lib:$QT_ROOT/plugins/platforms
export LD_PRELOAD=/usr/lib/preloadable_libiconv.so
export QML2_IMPORT_PATH=$QT_ROOT/qml
11.添加openGL
修改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)
QMAKE_INCDIR_EGL = /home/qt/mfg_rootfs/usr/include
QMAKE_LIBDIR_EGL = /home/qt/mfg_rootfs/usr/lib
QMAKE_INCDIR_OPENGL_ES2 = /home/qt/mfg_rootfs/usr/include
QMAKE_LIBDIR_OPENGL_ES2 = /home/qt/mfg_rootfs/usr/lib
QMAKE_LIBS_EGL += -lEGL
QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL -lGAL
# modifications to g++.conf
QMAKE_CC = /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-gcc
QMAKE_CXX = /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-g++
QMAKE_LINK = /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-g++
QMAKE_LINK_SHLIB = /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-g++
# modifications to linux.conf
QMAKE_AR = /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-ar cqs
QMAKE_OBJCOPY = /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-objcopy
QMAKE_NM = /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-nm -P
QMAKE_STRIP = /opt/gcc-4.9.3-64-gnu/bin/mips64el-linux-strip
load(qt_config)
暂未成功,待解决