博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【TINY4412】QT5移植笔记:(3)QT5.6移植到Linux
阅读量:4086 次
发布时间:2019-05-25

本文共 15744 字,大约阅读时间需要 52 分钟。

【TINY4412】QT5移植笔记:(3)QT5.6移植到Linux

宿主机 : 虚拟机 Ubuntu 16.04 LTS / X64

目标板[底板]: Tiny4412SDK - 1506
目标板[核心板]: Tiny4412 - 1412
LINUX内核: 4.12.0
交叉编译器: arm-none-linux-gnueabi-gcc(gcc version 4.8.3 20140320)
日期: 2017-10-2 09:31:07
作者: SY

简介

5.6 版本和 5.7 版本还是有些不同,参考 5.7 版本的移植流程。

移植

虚拟机

修改配置文件

root@ubuntu:/opt/Qt/qt-everywhere-opensource-src-5.6.3# vim qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf ## qmake configuration for building with arm-linux-gnueabi-g++#MAKEFILE_GENERATOR      = UNIXCONFIG                 += incrementalQMAKE_INCREMENTAL_STYLE = sublibQT_QPA_DEFAULT_PLATFORM = linuxfb QMAKE_CFLAGS  += -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv7-a -mtune=cortex-a9QMAKE_CXXFLAGS += -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv7-a -mtune=cortex-a9include(../common/linux.conf)include(../common/gcc-base-unix.conf)include(../common/g++-unix.conf)# modifications to g++.confQMAKE_CC                = arm-none-linux-gnueabi-gcc -ltsQMAKE_CXX               = arm-none-linux-gnueabi-g++ -ltsQMAKE_LINK              = arm-none-linux-gnueabi-g++ -ltsQMAKE_LINK_SHLIB        = arm-none-linux-gnueabi-g++ -lts# modifications to linux.confQMAKE_AR                = arm-none-linux-gnueabi-ar cqsQMAKE_OBJCOPY           = arm-none-linux-gnueabi-objcopyQMAKE_NM                = arm-none-linux-gnueabi-nm -PQMAKE_STRIP             = arm-none-linux-gnueabi-stripload(qt_config)

建立安装目录

root@ubuntu:/opt/Qt/qt-everywhere-opensource-src-5.6.3# mkdir -p /usr/local/Qt5.6.3

建立一个 make_auto.sh 脚本

#!/bin/bash################################################## Developer: SY# Data     : 2017-9-16 10:26:13# Function : Auto Configure Project#################################################./configure -prefix /usr/local/Qt5.6.3 \  -opensource \  -release \  -confirm-license \  -xplatform linux-arm-gnueabi-g++ \  -shared \  -qt-zlib \  -no-gif \  -qt-libjpeg \  -no-opengl \  -no-cups \  -no-glib \  -no-dbus \  -no-rpath \  -no-sse2 -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 \  -no-avx  \  -no-openssl \  -nomake tools \  -qreal float \  -qt-libpng \  -tslib \  -nomake examples \  -I /usr/local/tslib/include \  -L /usr/local/tslib/lib \
  • 支持多点触摸:-mtdev -xinput2 ,但是添加会出错。

执行脚本

root@ubuntu:/opt/Qt/qt-everywhere-opensource-src-5.6.3# ./make_auto.sh + cd qtbase+ /opt/Qt/qt-everywhere-opensource-src-5.6.3/qtbase/configure -top-level -prefix /usr/local/Qt5.6.3 -opensource -release -confirm-license -xplatform linux-arm-gnueabi-g++ -shared -qt-zlib -no-gif -qt-libjpeg -no-opengl -no-cups -no-glib -no-dbus -no-rpath -no-sse2 -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 -no-avx -no-openssl -nomake tools -qreal float -qt-libpng -tslib -nomake examples -I /usr/local/tslib/include -L /usr/local/tslib/libThis is the Qt Open Source Edition.You are licensed to use this software under the terms ofthe GNU Lesser General Public License (LGPL) version 2.1.You are also licensed to use this software under the terms ofthe GNU Lesser General Public License (LGPL) version 3.You have already accepted the terms of the Open Source license.Running configuration tests (phase 1)...Done running configuration tests.Creating qmake....Done.Running configuration tests (phase 2)...Warning: Disabling pkg-config since PKG_CONFIG_LIBDIR is not set andthe host's .pc files would be used (even if you set PKG_CONFIG_PATH).Set this variable to the directory that contains target .pc filesfor pkg-config to function correctly when cross-compiling oruse -pkg-config to override this test.Warning: Disabling pkg-config since PKG_CONFIG_SYSROOT_DIR is not set.Set this variable to your sysroot for pkg-config to function correctly whencross-compiling or use -pkg-config to override this test.checking for C++11...  yes.checking for C++14...  no.checking for default C++ standard edition...  yes.checking for 64-bit std::atomic...  yes.checking for ipc_sysv...  yes.checking for mtdev...  no.checking for dlopen...  no.checking for libdl...  yes.checking for DB2...  no.checking for InterBase...  no.checking for MySQL (thread-safe)...  no.checking for MySQL (thread-unsafe)...  no.checking for OCI...  no.checking for ODBC...  no.checking for iODBC...  no.checking for PostgreSQL...  no.checking for SQLite2...  no.checking for TDS...  no.checking for POSIX iconv...  yes.checking for libproxy...  no.checking for ICU...  no.checking for PulseAudio...  no.checking for FontConfig...  no.checking for libudev...  no.checking for evdev...  yes.checking for tslib...  yes.checking for xkbcommon...  no.checking for XLib...  no.checking for Xrender...  no.checking for XInput2...  no.checking for xcb...  no.checking for GBM...  no.checking for LinuxFB...  yes.checking for KMS...  no.checking for Mir client...  no.checking for EGL...  no.checking for FreeType...  no.checking for STL...  yes.checking for POSIX clock_gettime()...  yes.checking for POSIX Monotonic Clock...  yes.checking for posix_fallocate...  yes.checking for mremap...  yes.checking for getaddrinfo...  yes.checking for inotify...  yes.checking for eventfd...  yes.checking for IPv6 interface name...  yes.checking for getifaddrs...  yes.checking for cloexec...  yes.checking for PCRE...  no.checking for OpenVG...  no.checking for OpenVG...  no.checking for OpenVG (lc includes)...  no.checking for OpenVG (lc includes)...  no.checking for alsa...  no.checking for GStreamer 1.0...  no.checking for GStreamer 0.10...  no.Done running configuration tests.   Configure summaryBuilding on:   linux-g++ (x86_64, CPU features: mmx sse sse2)Building for:  linux-arm-gnueabi-g++ (arm, CPU features: none detected)Platform notes:            - Also available for Linux: linux-clang linux-kcc linux-icc linux-cxxBuild options:  Configuration .......... accessibility audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent cross_compile evdev eventfd freetype full-config getaddrinfo getifaddrs harfbuzz iconv inotify ipv6ifname large-config largefile linuxfb medium-config minimal-config mremap no-gif no-pkg-config pcre png posix_fallocate qpa qpa reduce_exports release shared small-config threadsafe-cloexec tslib zlib   Build parts ............ libs  Mode ................... release  Using sanitizer(s)...... none  Using C++ standard ..... c++11  Using gold linker....... no  Using new DTAGS ........ no  Using PCH .............. no  Using LTCG ............. no  Target compiler supports:    Neon ................. noQt modules and options:  Qt D-Bus ............... no  Qt Concurrent .......... yes  Qt GUI ................. yes  Qt Widgets ............. yes  Large File ............. yes  QML debugging .......... yes  Use system proxies ..... noSupport enabled for:  Accessibility .......... yes  ALSA ................... no  CUPS ................... no  Evdev .................. yes  FontConfig ............. no  FreeType ............... yes (bundled copy)  Glib ................... no  GStreamer .............. no  GTK theme .............. no  HarfBuzz ............... yes (bundled copy)  Iconv .................. yes  ICU .................... no  Image formats:     GIF .................. no    JPEG ................. yes (plugin, using bundled copy)    PNG .................. yes (in QtGui, using bundled copy)  libinput................ no  Logging backends:     journald ............... no    syslog   ............... no  mtdev .................. no  Networking:     getaddrinfo .......... yes    getifaddrs ........... yes    IPv6 ifname .......... yes    libproxy.............. no    OpenSSL .............. no  OpenGL / OpenVG:     EGL .................. no    OpenGL ............... no    OpenVG ............... no  PCRE ................... yes (bundled copy)  pkg-config ............. no   PulseAudio ............. no  QPA backends:     DirectFB ............. no    EGLFS ................ no      EGLFS i.MX6 ........ no      EGLFS i.MX6 Wayland. no      EGLFS EGLDevice .... no      EGLFS GBM .......... no      EGLFS Mali ......... no      EGLFS Raspberry Pi . no      EGLFS X11 .......... no    LinuxFB .............. yes    Mir client............ no    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)Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_bootstrap_private.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_concurrent.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_concurrent_private.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_core.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_core_private.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_gui.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_gui_private.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_network.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_network_private.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_platformsupport_private.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_printsupport.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_printsupport_private.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_sql.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_sql_private.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_testlib.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_testlib_private.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_widgets.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_widgets_private.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_xml.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_xml_private.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_zlib_private.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qevdevkeyboardplugin.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qevdevmouseplugin.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qevdevtabletplugin.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qevdevtouchplugin.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qgenericbearer.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qico.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qjpeg.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qlinuxfb.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qminimal.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qoffscreen.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qsqlite.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qtslibplugin.pri: No such file or directoryCannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qtuiotouchplugin.pri: No such file or directoryQt is now configured for building. Just run 'make'.Once everything is built, you must run 'make install'.Qt will be installed into /usr/local/Qt5.6.3Prior to reconfiguration, make sure you remove any leftovers fromthe previous build.

然后执行:make -j4

然后执行:make install ,安装文件被安装到路径:/usr/local/Qt5.6.3

root@ubuntu:/opt/Qt/qt-everywhere-opensource-src-5.6.3# cd /usr/local/Qt5.6.3/root@ubuntu:/usr/local/Qt5.6.3# lsbin  doc  include  lib  mkspecs  plugins  qml  translationsroot@ubuntu:/usr/local/Qt5.6.3# ls bin/canbusutil        lrelease  qdoc   qml               qmlmin   qtplugininfo  uicfixqt4headers.pl  lupdate   qlalr  qmlimportscanner  qtdiag   rcc           xmlpatternslconvert          moc       qmake  qmllint           qtpaths  syncqt.pl     xmlpatternsvalidator

其中:qmake 就是用于自动生成 Makefile 的工具,以后编译 qt 工程的时候会经常遇到。

开发板

将该目录下的所有文件拷贝到开发板的根文件系统:

root@ubuntu:/usr/local/Qt5.6.3# mkdir /opt/fs/rootfs/rootfs/usr/local/Qt5.6.3root@ubuntu:/usr/local/Qt5.6.3# cp -a * /opt/fs/rootfs/rootfs/usr/local/Qt5.6.3/

修改配置文件

root@ubuntu:/opt/fs/rootfs/rootfs# cat etc/profile    # /etc/profile: system-wide .profile file for the Bourne shellsecho ""echo -n "Processing /etc/profile... "# No core files by defaultulimit -S -c 0 > /dev/null 2>&1USER="`id -un`"LOGNAME=$USERHOSTNAME='/bin/hostname'PS1='[\u@\h:\w]# 'PATH=$PATHexport USER LOGNAME PS1 PATH# tslibexport TSLIB_CONSOLEDEVICE=noneexport TSLIB_FBDEVICE=/dev/fb0export TSLIB_TSDEVICE=/dev/input/event0export T_ROOT=/usr/local/tslibexport LD_LIBRARY_PATH=/usr/local/tslib/lib:$LD_LIBRARY_PATHexport TSLIB_PLUGINDIR=$T_ROOT/lib/tsexport TSLIB_CONFFILE=$T_ROOT/etc/ts.confexport POINTERCAL_FILE=/etc/pointercalexport TSLIB_CALIBFILE=/etc/pointercal# Qtexport QTEDIR=/usr/local/Qt5.6.3export LD_LIBRARY_PATH=/usr/local/Qt5.6.3/lib:$LD_LIBRARY_PATHexport QT_QPA_GENERIC_PLUGINS=tslibexport QT_QPA_FONTDIR=$QTEDIR/lib/fonts export QT_QPA_PLATFORM_PLUGIN_PATH=$QTEDIR/plugins export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:size=800x480:mmSize=800x480:offset=0x0:tty=/dev/tty1export QT_QPA_FB_TSLIB=1export QT_QPA_FB_HIDECURSOR=/dev/input/mouse1export LD_PRELOAD=$QTEDIR/lib/preloadable_libiconv.soecho "Done!"

添加库

root@ubuntu:/opt/fs/rootfs/rootfs# cp /opt/Qt/libiconv-1.14/_install/lib/preloadable_libiconv.so usr/local/Qt5.6.3/lib/

添加字体

从友善之臂的光盘中拷贝字体:DroidSansFallback.ttf 放到开发板路径:/usr/local/Qt5.6.3/lib/fonts

添加字体路径:

[root@TINY4412:~]# vi etc/profileexport QTEDIR=/usr/local/Qt5.6.3export QT_QPA_FONTDIR=$QTEDIR/lib/fonts

添加键盘

添加鼠标

添加触摸屏

添加虚拟键盘

测试

参考

转载地址:http://onzii.baihongyu.com/

你可能感兴趣的文章
SSM-CRUD(2)---查询
查看>>
SSM-CRUD (3)---查询功能改造
查看>>
Nginx(2)---安装与启动
查看>>
springBoot(5)---整合servlet、Filter、Listener
查看>>
C++ 模板类型参数
查看>>
C++ 非类型模版参数
查看>>
设计模式 依赖倒转原则 & 里氏代换原则
查看>>
DirectX11 光照
查看>>
图形学 图形渲染管线
查看>>
DirectX11 计时和动画
查看>>
DirectX11 光照与材质的相互作用
查看>>
DirectX11 法线向量
查看>>
DirectX11 兰伯特余弦定理(Lambert)
查看>>
DirectX11 漫反射光
查看>>
DirectX11 环境光
查看>>
DirectX11 镜面光
查看>>
DirectX11 三种光照组成对比
查看>>
DirectX11 指定材质
查看>>
DirectX11 平行光
查看>>
DirectX11 点光
查看>>