目前使用的板子是IMX6,
下载yocto开发环境imx-4.1.15-2.1.0_ga,
1、repo命令是
# ~/bin/repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-4.1.15-1.0.0_ga
2、编译的sysroot命令
# bitbake fsl-image-qt5
3、交叉编译环境命令
bitbake meta-toolchain-qt5
4、生成文件系统命令
#sh tmp/deploy/sdk/fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-vfp-neon-toolchain-4.1.15-1.2.0.sh
然后编译QT5.12
注:(yocto交叉编译工具为arm-poky-linux-gnueabi-gcc,我用的是arm-linux-gnueabihf-gcc)
#
# 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_OPENGL_ES2 += /opt/fsl-imx-fb/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include
QMAKE_LIBDIR_OPENGL_ES2 += /opt/fsl-imx-fb/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib
QMAKE_INCDIR += /opt/fsl-imx-fb/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include
QMAKE_LIBDIR += /opt/fsl-imx-fb/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib
QMAKE_LIBS += -lz -lbz2 -lpng -lfreetype -lexpat -lxml2 -lfontconfig
QMAKE_LIBS_EGL += -lEGL
QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL -lGAL
QMAKE_LIBS_OPENVG += -lOpenVG -lEGL -lGAL
IMX6_CFLAGS =-march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 -DLINUX=1 -DEGL_API_FB=1 -fPIC
QMAKE_CFLAGS += $$IMX6_CFLAGS
QMAKE_CXXFLAGS += $$IMX6_CFLAGS
DISTRO_OPTS+= hard-float
#Preferred eglfs backend
EGLFS_DEVICE_INTEGRATION= eglfs_viv
QT_QPA_DEFAULT_PLATFORM= eglfs
QMAKE_CFLAGS_RELEASE += -O2 $$QMAKE_CFLAGS
QMAKE_CXXFLAGS_RELEASE += -O2 $$QMAKE_CXXFLAGS
# 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)
./configure -prefix /Qt5.12x_opengl -opensource -confirm-license -shared -release -xplatform linux-arm-gnueabihf-g++ -qt-pcre -no-libproxy -no-pch -no-rpath -no-alsa -no-cups -dbus -no-directfb -evdev -no-harfbuzz -no-iconv -no-kms -no-openvg -webengine-icu -icu -qt-zlib -qt-libpng -qt-freetype -sysconfdir /Qt5.12x_opengl/sysconf -nomake tests -nomake examples -eglfs -opengl es2 -device-option CROSS_COMPILE=/opt/fsl-imx-fb/4.1.15-1.2.0/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi- -sysroot /opt/fsl-imx-fb/4.1.15-1.2.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi -v
编译完成之后将库复制到/usr/local目录下
ARM板配置环境
export QTDIR=/usr/local
export PATH=$QTDIR:$PATH
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins
export QT_QPA_PLATFORM=eglfs:tty=/dev/fb0
export QT_QPA_FONTDIR=$QTDIR/lib/fonts
export QT_QPA_GENERIC_PLUGINS=evdevtouch:$TSLIB_TSDEVICE
export LD_LIBRARY_PATH=$QTDIR:$QTDIR/lib/:$QT_QPA_PLATFORM_PLUGIN_PATH:$QT_QPA_FONTDIR:$LD_LIBRARY_PATH
export QML2_IMPORT_PATH=/usr/local/qml
运行程序后./target -platform eglfs
qt.qpa.plugin: Could not load the Qt platform plugin "eglfs" in "/usr/local/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, webgl.
Aborted
下载了两次yocto都是一样的结果,求指导