Qt5.10.0移植到freescale imx6
HOST:deepin
Embedded:freescale imx6 linux-3.0.35
CROSS_COMPILE:freescale提供的交叉编译器
http://mirrors.ustc.edu.cn/qtproject/archive/qt/5.10/5.10.0/single/
unzip qt-everywhere-opensource-src-5.10.0.tar.gz
cd qt-everywhere-opensource-src-5.10.0
vi qtbase/mkspecs/devices/linux-imx6-g++/qmake.conf
以下为全部内容,其他平台qtbase/mkspecs/devices/下要是没有单独提供,可以使用qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf,需根据自己平台做相应修改。
#
# qmake configuration for the Freescale iMX6 boards (single, dual and quad)
#
# The configuration below is set up for running with EGL on the framebuffer via
# the eglfs platform plugin and its eglfs_viv backend.
# Wayland is also fully functional out of the box. However, when writing Wayland
# *compositors* with Qt, the eglfs backend will have to be switched to
# eglfs_viv_wl by setting the QT_QPA_EGLFS_INTEGRATION environment variable.
#
# Below is an example configure line that assumes the SDK is in
# $HOME/imx6/toolchain. On device Qt is expected to be placed under
# /usr/local/qt5 whereas on the host 'make install' will copy the host tools and
# the target libraries to $HOME/imx6/qt5.
#
# ./configure -prefix /usr/local/qt5 -extprefix $HOME/imx6/qt5 -device linux-imx6-g++ \
# -device-option CROSS_COMPILE=$HOME/imx6/toolchain/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi- \
# -sysroot $HOME/imx6/toolchain/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi \
# -nomake examples -nomake tests -v
#
include(../common/linux_device_pre.conf)
QMAKE_LIBS_EGL += -lEGL
QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL -lGAL
QMAKE_LIBS_OPENVG += -lOpenVG -lEGL -lGAL
IMX6_CFLAGS = -march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1
QMAKE_CFLAGS += $$IMX6_CFLAGS
QMAKE_CXXFLAGS += $$IMX6_CFLAGS
DISTRO_OPTS += hard-float
# Preferred eglfs backend
EGLFS_DEVICE_INTEGRATION = eglfs_viv
include(../common/linux_arm_device_post.conf)
load(qt_config)
是的你没看错,其实QT提供了完整的编译命令,我们只用修改对应的参数,和编译选项就行了
./configure -prefix /home/shining/arm/Qt5.12.4 -extprefix /opt/poky/1.6.2/sysroots/i686-pokysdk-linux/usr/bin/qt5 -device linux-imx6-g++ \
-device-option CROSS_COMPILE=/opt/poky/1.6.2/sysroots/i686-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi- \
-sysroot /opt/poky/1.6.2/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi \
-nomake tests -v
CROSS_COMPILE= 指定交叉编译器路径,注意 末尾只是到这里-gnueabi- ;
配置结果如下:
[cpp] view plain copy
print?
Build options:
Configuration … accessibility alsa audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent cross_compile dbus eglfs_viv enable_new_dtags evdev eventfd freetype full-config getaddrinfo getifaddrs harfbuzz inotify ipv6ifname large-config largefile linuxfb medium-config minimal-config mremap neon nis no-pkg-config opengl opengles2 openvg pcre png posix_fallocate qpa qpa reduce_exports release rpath shared small-config system-jpeg tslib zlib
Build parts … libs examples
Mode … release
Using sanitizer(s)… none
Using C++11 … yes
Using gold linker… no
Using new DTAGS … yes
Using PCH … no
Target compiler supports:
Neon … yes
Qt modules and options:
Qt D-Bus … yes (loading dbus-1 at runtime)
Qt Concurrent … yes
Qt GUI … yes
Qt Widgets … yes
Large File … yes
QML debugging … yes
Use system proxies … no
Support enabled for:
Accessibility … yes
ALSA … yes
CUPS … no
Evdev … yes
FontConfig … no
FreeType … yes (bundled copy)
Glib … no
GStreamer … no
GTK theme … no
HarfBuzz … yes (bundled copy)
Iconv … no
ICU … no
Image formats:
GIF … yes (plugin, using bundled copy)
JPEG … yes (plugin, using system library)
PNG … yes (in QtGui, using bundled copy)
journald … no
libinput… no
mtdev … no
Networking:
getaddrinfo … yes
getifaddrs … yes
IPv6 ifname … yes
libproxy… no
OpenSSL … no
NIS … yes
OpenGL / OpenVG:
EGL … no
OpenGL … yes (OpenGL ES 2.0+)
OpenVG … yes-auto
PCRE … yes (bundled copy)
pkg-config … no
PulseAudio … no
QPA backends:
DirectFB … no
EGLFS … no
EGLFS i.MX6… . yes
EGLFS KMS … no
EGLFS Mali … no
EGLFS Raspberry Pi . no
EGLFS X11 … no
LinuxFB … yes
XCB … no
Session management … yes
SQL drivers:
DB2 … no
InterBase … no
MySQL … no
OCI … no
ODBC … no
PostgreSQL … no
SQLite 2 … no
SQLite … yes (plugin, using bundled copy)
TDS … no
tslib … yes
udev … no
xkbcommon-x11… no
xkbcommon-evdev… no
zlib … yes (bundled copy)
1、make -j8
2、make install
1、将qt5.10.0打包拷贝到文件系统/usr/local/下,其中包含了qt5的examples,可以删除。
2、添加QT系统环境变量
vi /etc/profile添加
#for QT
export QT_ROOT=/usr/local/qt5.5.1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:/usr/lib:$QT_ROOT/lib
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export QT_QPA_FONTDIR=$QT_ROOT/lib/fonts
export QT_QPA_GENERIC_PLUGINS=evdevtouch:/dev/input/event0
export PATH=/bin:/sbin:/usr/bin/:/usr/sbin
export QML2_IMPORT_PATH=$QT_ROOT/qml
#export QT_QPA_GENERIC_PLUGINS=tslib:$TSLIB_TSDEVICE//如果触摸使用TSlib支持则修改为该句。
#export QT_QPA_EGLFS_FB=/dev/fb1
注:QT触摸屏支持可以不使用tslib。
3、tslib移植及支持请看http://blog.csdn.net/xishuang_gongzi/article/details/49422879