Qt imx6 library compilation

Configuration before compilation

        Installation and Configuration cross compiler tool chain: poky-glibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-1.7.sh.
        Download and set up for imx6 file systems: fsl-image-gui-imx6qsabresd.tar.bz2.
        Unzip the source code, for example: go qt-everywhere-src-5.14.1.tar.xzto the directory /home/workspace/qt-everywhere-src-5.14.1, modify the file:, /home/workspace/qt-everywhere-src-5.14.1/qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.confas follows:

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

MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib

# 配置交叉编译参数
IMX6_CFLAGS = -march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1
IMX6_CFLAGS_RELEASE = -O2 $$IMX6_CFLAGS

QMAKE_CFLAGS_DEBUG += $$IMX6_CFLAGS
QMAKE_CXXFLAGS_DEBUG += $$IMX6_CFLAGS
QMAKE_CFLAGS_RELEASE += $$IMX6_CFLAGS_RELEASE
QMAKE_CXXFLAGS_RELEASE += $$IMX6_CFLAGS_RELEASE

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

# 配置交叉编译工具路径
POKY_PATH = /opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi
# 配置交叉编译文件系统
ROOTFS_PATH = /opt/fsl-image-gui-imx6qsabresd

# 配置交叉编译工具
# modifications to g++.conf
QMAKE_CC = $$POKY_PATH/arm-poky-linux-gnueabi-gcc -mfloat-abi=hard
QMAKE_CXX = $$POKY_PATH/arm-poky-linux-gnueabi-g++ -mfloat-abi=hard
QMAKE_LINK = $$POKY_PATH/arm-poky-linux-gnueabi-g++ -mfloat-abi=hard
QMAKE_LINK_SHLIB = $$POKY_PATH/arm-poky-linux-gnueabi-g++ -mfloat-abi=hard

# modifications to linux.conf
QMAKE_AR = $$POKY_PATH/arm-poky-linux-gnueabi-ar cqs
QMAKE_OBJCOPY = $$POKY_PATH/arm-poky-linux-gnueabi-objcopy
QMAKE_NM = $$POKY_PATH/arm-poky-linux-gnueabi-nm -P
QMAKE_STRIP = $$POKY_PATH/arm-poky-linux-gnueabi-strip

# 配置依赖头文件和库目录
QMAKE_INCDIR += $$ROOTFS_PATH/usr/include
QMAKE_LIBDIR += $$ROOTFS_PATH/usr/lib

# 配置依赖库引用(下面是引用OpenGL库,还可以引用其他库)
QMAKE_LIBS_EGL += -lEGL -lGAL
QMAKE_LIBS_OPENGL_ES1 += -lGLESv1_CM -lEGL -lGAL
QMAKE_LIBS_OPENGL_ES1CL += -lGLES_CL -lEGL -lGAL
QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL -lGAL -lVSC
QMAKE_LIBS_OPENVG += -lOpenVG -lEGL -lGAL -lVSC

load(qt_config)

        Create a build directory, for /home/workspace/qt-buildexample: . Command option description . Enter the build directory through the terminal and enter the command:

./../qt-everywhere-src-5.14.1/configure \
-verbose \
-opensource \
-release \
-shared \
-confirm-license \
-eglfs \
-linuxfb \
-openvg \
-make libs \
-xplatform linux-arm-gnueabi-g++ \
-prefix /opt/qt-5.14.1-imx6

        If the OpenGL function is not enabled, enter the command:

./../qt-everywhere-src-5.14.1/configure \
-verbose \
-opensource \
-release \
-shared \
-confirm-license \
-linuxfb \
-make libs \
-no-opengl \
-xplatform linux-arm-gnueabi-g++ \
-prefix /opt/qt-5.14.1-imx6

Compile the source code

        After successful configuration, enter the command: make, memory, 4G or more preferably greater than, or in some cases, the compiler could, however , enter into compiling process, wait for about three to four hours after the compilation is successful, enter the command: make installcan the qt library is installed to the /opt/qt-5.14.1-imx6directory: .

Add system font

        Enter the directory:, /opt/qt-5.14.1-imx6/libcreate a font directory fonts, you can .ttfcopy font files to the font directory.

Configure development board

1. Copy the related library of qt after installation to the specified directory of the target board, for example:

  • Create a directory: /opt/qt-5.14.1-imx6.
  • Copy the folder: lib, plugins, qml to the created directory.

2. Configuration/etc/profile

  • Use eglfs to start the OpenGL function:
export QTDIR=/opt/qt-5.14.1-imx6
export QT_PLUGIN_PATH=$QTDIR/plugins
export QML2_IMPORT_PATH=$QTDIR/qml
export QT_QPA_FONTDIR=$QTDIR/lib/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins/platforms
export QT_QPA_PLATFORM=eglfs
export QT_QPA_EGLFS_INTEGRATION=eglfs_viv
export QT_QPA_EGLFS_FORCEVSYNC=1
export FB_MULTI_BUFFER=2
export XDG_RUNTIME_DIR=/tmp
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
  • Use linuxfb function:
export QTDIR=/opt/qt-5.14.1-imx6
export QT_PLUGIN_PATH=$QTDIR/plugins
export QML2_IMPORT_PATH=$QTDIR/qml
export QT_QPA_FONTDIR=$QTDIR/lib/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins/platforms
export QT_QPA_PLATFORM=linuxfb
export XDG_RUNTIME_DIR=/tmp
export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
Published 32 original articles · won praise 1 · views 4551

Guess you like

Origin blog.csdn.net/hezhanran/article/details/105051843