全志a20 x11 qt5 环境 搭建

时间:2021-11-04 15:17:05

记录 qt5 x11  opengl  过程


我使用的是 debian 7 系统  下载 debian 基础包


安装环境

apt-get install libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev \
libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev \
libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev \
libxcb-sync0-dev libxcb-render-util0 libxcb-render-util0-dev \
libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev \
libxcb-glx0-dev

也安装一下

apt-get install zlib1g-dev

下载qt5.4 源码 git 太慢了 我直接下载 打包好的 网速还是很给力的

http://mirrors.ustc.edu.cn/qtproject/archive/qt/5.4/5.4.0/single/qt-everywhere-opensource-src-5.4.0.7z

解压进入  源码路径 

mkdir qtbase/mkspecs/devices/linux-sunxi-g++

cat> qtbase/mkspecs/devices/linux-sunxi-g++/qplatformdefs.h <<
"EOF"
#include "../../linux-g++/qplatformdefs.h" EOF


cat > qtbase/mkspecs/devices/linux-sunxi-g++/qmake.conf << "EOF"
#
# Qt system configuration for Sunxi Cortex-A8 devices
#
# Mali library and include files should be found in the standard locations in
# /usr in sysroot.
#

include(../common/linux_device_pre.conf)

QT_QPA_DEFAULT_PLATFORM = xcb

DISTRO_OPTS += deb-multi-arch
DISTRO_OPTS += hard-float

SYSROOT_INC = $$[QT_SYSROOT]/usr/include
SYSROOT_LIB = $$[QT_SYSROOT]/usr/lib

COMPILER_FLAGS = -marm -march=armv7-a -mtune=cortex-a8

QMAKE_CFLAGS += -I $${SYSROOT_INC} \
-I $${SYSROOT_INC}/$${GCC_MACHINE_DUMP}

QMAKE_CXXFLAGS += -I $${SYSROOT_INC} \
-I $${SYSROOT_INC}/$${GCC_MACHINE_DUMP}

QMAKE_CXXFLAGS_RELEASE += -O3

QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib \
-Wl,-rpath-link,$$[QT_SYSROOT]/lib

QMAKE_LIBS += -lrt -lpthread -ldl

# Mali EGL and GLES2 are in fact located in the same .so file.
QMAKE_INCDIR_EGL = $$[SYSROOT_INC]
QMAKE_LIBDIR_EGL = $$[SYSROOT_LIB]
QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL}
QMAKE_LIBDIR_OPENGL_ES2 = $${QMAKE_LIBDIR_EGL}

QMAKE_LIBS_EGL = -lEGL
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2

include(../common/linux_arm_device_post.conf)

load(qt_config)
EOF



配置qt5

SUNXI_SYSROOT  是 我们debian 的目录

./configure -v -debug -opensource -confirm-license -no-use-gold-linker \
-nomake examples -nomake tests -nomake tools -no-cups -no-pch -no-linuxfb \
-skip qtquick1 -skip declarative -skip multimedia -opengl es2 -no-eglfs \
-system-xcb -system-zlib -sysroot $SUNXI_SYSROOT -device linux-sunxi-g++ \
-device-option CROSS_COMPILE=arm-linux-gnueabihf- -prefix /opt/qt/sunxi

make  -j8

make install 


编译过程可能遇到找不到 dbus  加上 no-dbus 即可

完成  刷机到a20  应该可以了


编译qt 之前需要 安装mali 环境  后面来补充