Qt5: QT5 dynamic library compilation for embedded devices, QT5 porting

Introduction

The development environment is ubuntu14.04, and the development tool is TI's official sdk (AM57xx series). The required qt source code is downloaded from the official website. It does not support touch screen, so tslib is not added.

need tools

- Perl 5.8 or later
- Python 2.7 or later
- C++ compiler supporting the C++98 standard(SDK提供)
- 编译套装 `sudo apt-get install build-essential`

Auxiliary tool

sudo apt-get install Git git-core
sudo apt-get install autoconf bison flex gperf
sudo apt install libtool

Environment settings

Global environment settings

Edit ~/.bashrc to add:
export PATH="/home/codebee/ti-linux-am57xx/linux-devkit/sysroots/x86_64-arago-linux/usr/bin:$PATH"

Qt source code compilation environment settings

Enter the qt-everywhere-opensource-src-5.6.2/qtbase/mkspecs folder, copy linux-arm-gnueabi-g++ and name it linux-arm-gnueabihf Open the qmake.conf and modify the contents as follows

#
# qmake configuration for building with arm-linux-gnueabi-g++
#

MAKEFILE_GENERATOR      = UNIX
CONFIG                 += incremental
QMAKE_INCREMENTAL_STYLE = sublib

QT_QPA_DEFAULT_PLATFORM = eglfs
QMAKE_LIBS_EGL         += -lEGL
QMAKE_LIBS_OPENGL_ES2  += -lGLESv2 -lEGL -lGAL

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

# 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)

Generate a makefile for compiling Qt

Enter the qt-everywhere-opensource-src-5.6.2 folder and create a new config.sh file with the following contents

./configure -opensource -confirm-license \
-release -c++std c++11 \
--prefix=/opt/QT5 \
-xplatform linux-arm-gnueabihf \
-shared \
-iconv \
-developer-build  \
-eglfs  -opengl es2 \
-qt-zlib -qt-libjpeg -qt-libpng -dbus-runtime \
-nomake examples -nomake tests -no-xcb -no-iconv \
-skip qtenginio -skip qtlocation -skip qtmultimedia   \
-skip qtwebsockets -v


#-tslib \
#-make tools \
#-v 是详细输出模式
#--prefix是make install后编译好的qt安装的位置
# -no-icu, this will disable the webkit.
#make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4
#make install

If there is no error in executing config.sh, the makefile will be generated, and then execute (-j4 means compiling with four threads, which is consistent with the number of your own cpu, not the larger the number, the faster)

make -j4
sudo make install

Development board environment qt environment configuration

The compiled qt package is copied to the /opt directory of the development board and decompressed

configure lib

vi /etc/ld.so.conf Add a line to /opt/lib
and execute sudo ldconfig -v

Configure the Qt runtime environment

export QTDIR=/opt
export QT_QPA_FONTDIR=$QTDIR/lib/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
#export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:size=1920x1080:mmSize=1024x768:offset=0x0:tty=/dev/tty1
export QML_IMPORT_PATH=$QTDIR/qml
export QML2_IMPORT_PATH=$QTDIR/qml
export QT_QPA_EGLFS_FB="/dev/fb0"
#export QT_QPA_EGLFS_WIDTH=1920
#export QT_QPA_EGLFS_HEIGHT=1080
export QT_QPA_EGLFS_DEPTH=32
#export QT_QPA_EGLFS_PHYSICAL_WIDTH=1920
#export QT_QPA_EGLFS_PHYSICAL_HEIGHT=1080

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325812497&siteId=291194637