【TINY4412】QT5移植筆記:(3)QT5.6移植到Linux

【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      = UNIX
CONFIG                 += incremental
QMAKE_INCREMENTAL_STYLE = sublib

QT_QPA_DEFAULT_PLATFORM = linuxfb 
QMAKE_CFLAGS  += -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv7-a -mtune=cortex-a9
QMAKE_CXXFLAGS += -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv7-a -mtune=cortex-a9

include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)

# modifications to g++.conf
QMAKE_CC                = arm-none-linux-gnueabi-gcc -lts
QMAKE_CXX               = arm-none-linux-gnueabi-g++ -lts
QMAKE_LINK              = arm-none-linux-gnueabi-g++ -lts
QMAKE_LINK_SHLIB        = arm-none-linux-gnueabi-g++ -lts

# modifications to linux.conf
QMAKE_AR                = arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY           = arm-none-linux-gnueabi-objcopy
QMAKE_NM                = arm-none-linux-gnueabi-nm -P
QMAKE_STRIP             = arm-none-linux-gnueabi-strip
load(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/lib

This is the Qt Open Source Edition.

You are licensed to use this software under the terms of
the GNU Lesser General Public License (LGPL) version 2.1.
You are also licensed to use this software under the terms of
the 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 and
the host's .pc files would be used (even if you set PKG_CONFIG_PATH).
Set this variable to the directory that contains target .pc files
for pkg-config to function correctly when cross-compiling or
use -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 when
cross-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 summary

Building 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-cxx

Build 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 ................. no

Qt 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 ..... no

Support 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 directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_concurrent.pri: No such file or directory
Cannot 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 directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_core.pri: No such file or directory
Cannot 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 directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_gui.pri: No such file or directory
Cannot 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 directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_network.pri: No such file or directory
Cannot 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 directory
Cannot 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 directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_printsupport.pri: No such file or directory
Cannot 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 directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_sql.pri: No such file or directory
Cannot 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 directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_testlib.pri: No such file or directory
Cannot 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 directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_widgets.pri: No such file or directory
Cannot 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 directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_lib_xml.pri: No such file or directory
Cannot 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 directory
Cannot 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 directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qevdevkeyboardplugin.pri: No such file or directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qevdevmouseplugin.pri: No such file or directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qevdevtabletplugin.pri: No such file or directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qevdevtouchplugin.pri: No such file or directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qgenericbearer.pri: No such file or directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qico.pri: No such file or directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qjpeg.pri: No such file or directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qlinuxfb.pri: No such file or directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qminimal.pri: No such file or directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qoffscreen.pri: No such file or directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qsqlite.pri: No such file or directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qtslibplugin.pri: No such file or directory
Cannot read /opt/Qt5.7.0/qt-everywhere-opensource-src-5.6.3/qtbase/mkspecs/modules-inst/qt_plugin_qtuiotouchplugin.pri: No such file or directory

Qt 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.3

Prior to reconfiguration, make sure you remove any leftovers from
the 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# ls
bin  doc  include  lib  mkspecs  plugins  qml  translations
root@ubuntu:/usr/local/Qt5.6.3# ls bin/
canbusutil        lrelease  qdoc   qml               qmlmin   qtplugininfo  uic
fixqt4headers.pl  lupdate   qlalr  qmlimportscanner  qtdiag   rcc           xmlpatterns
lconvert          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.3
root@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 shells

echo ""
echo -n "Processing /etc/profile... "

# No core files by default
ulimit -S -c 0 > /dev/null 2>&1

USER="`id -un`"
LOGNAME=$USER
HOSTNAME='/bin/hostname'

PS1='[\u@\h:\w]# '
PATH=$PATH

export USER LOGNAME PS1 PATH

# tslib
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event0


export T_ROOT=/usr/local/tslib
export LD_LIBRARY_PATH=/usr/local/tslib/lib:$LD_LIBRARY_PATH
export TSLIB_PLUGINDIR=$T_ROOT/lib/ts
export TSLIB_CONFFILE=$T_ROOT/etc/ts.conf
export POINTERCAL_FILE=/etc/pointercal
export TSLIB_CALIBFILE=/etc/pointercal

# Qt
export QTEDIR=/usr/local/Qt5.6.3
export LD_LIBRARY_PATH=/usr/local/Qt5.6.3/lib:$LD_LIBRARY_PATH
export QT_QPA_GENERIC_PLUGINS=tslib
export 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/tty1
export QT_QPA_FB_TSLIB=1
export QT_QPA_FB_HIDECURSOR=/dev/input/mouse1
export LD_PRELOAD=$QTEDIR/lib/preloadable_libiconv.so


echo "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/profile
export QTEDIR=/usr/local/Qt5.6.3
export QT_QPA_FONTDIR=$QTEDIR/lib/fonts

添加鍵盤

添加鼠標

添加觸摸屏

添加虛擬鍵盤

測試

參考

移植QT5.6到嵌入式開發板(史上最詳細的QT移植教程)

Qt-5.3.2 在友善Smart210開發板的移植記錄

Qt:5.7虛擬鍵盤中拼音輸入法的使用

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章