xplatform: 选择交叉编译时的目标 mkspec
prefix :指定 make install 的位置
./configure -release -opensource -confirm-license -xplatform aarch64-linux-gnu-gcc -prefix /opt/aarch64—qt5 -nomake examples -nomake tools -nomake tests -no-opengl
安装编译所依赖的库
安装基础的编译环境
sudo apt-get build-essential qt5-default
sudo apt-get install libxcb-xinerama0-dev
sudo apt-get install build-essential perl python git
Libxcb
sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
OpenGL
sudo apt-get install build-essential
sudo apt-get install libgl1-mesa-dev
sudo apt-get install libglu1-mesa-dev
sudo apt-get install libegl1-mesa-dev
sudo apt-get install freeglut3-dev
Qt WebKit
sudo apt-get install flex bison gperf libicu-dev libxslt-dev ruby
Qt WebEngine
sudo apt-get install libssl-dev libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libdbus-1-dev libfontconfig1-dev libcap-dev libxtst-dev libpulse-dev libudev-dev libpci-dev libnss3-dev libasound2-dev libxss-dev libegl1-mesa-dev gperf bison
Qt Multimedia
sudo apt-get install libasound2-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
QDoc Documentation Generator Tool
sudo apt install libclang-6.0-dev llvm-6.0
QtBase相关依赖
sudo apt-get install bison build-essential qt5-default
sudo apt-get install perl git gperf ruby
sudo apt-get install libclang-10-dev llvm-10*
sudo apt-get install xcb* libxcb* libx11* libxkbcommon* libxrender* libxi-dev
QtOpenGL相关依赖
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev libegl1-mesa-dev freeglut* libgles* libglew*
QtWebengine相关依赖
sudo apt-get install flex libicu-dev libxslt-dev
sudo apt-get install libssl-dev libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev
sudo apt-get install libdus* dbus*
sudo apt-get install libfontconfig1-dev fontconfig libcap-dev libxtst-dev libxext-dev
sudo apt-get install libpulse-dev libudev-dev libpci-dev libnss3-dev libasound2-dev libxss-dev
sudo apt-get install libgstreamer-gl1.0-0 libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
sudo apt-get install libcups2* pulseaudio* alsa-* mesa-* systemd* system-* libgudev-1.0-dev libatspi2.0* at-spi2-* libclipper-dev
sudo apt-get install nodejs gyp ninja-build libdrm-dev
QtBlueTooth相关依赖
sudo apt-get install bluez* bluetooth libbluetooth*
Qtmultimedia相关依赖
sudo apt-get install libwayland-dev
创建自动配置脚本
#!/bin/sh
./configure \
-platform linux-aarch64-gnu-g++ \
-prefix /opt/qt5.12.8_aarch64 \
-confirm-license \
-opensource \
-release \
-shared \
-make libs \
-nomake examples \
-nomake tests \
-dbus \
-opengl \
-pch \
-qt-libjpeg \
-qt-libpng \
-qt-zlib \
-xcb \
-alsa \
-gif \
-gstreamer 1.0 \
-pulseaudio \
-fontconfig \
-system-freetype
编译安装Qt5.15.6 过程中遇到的问题处理集
交叉编译带opengl的qt5.12.0(eglfs-mali 、eglfs-x11)
添加QT支持OpenGL es2和eglfs库的路劲和头文件。 确定文件系统中包含opengl的库。可以在文件系统usr目录下找一下libEGL.so libGLESv2.so这两个库
find .| grep "EGL"
find .| grep "GLESv2"
如果没有找到相应的库。可以通过下面命令安装。
sudo apt-get install libgles2-mesa
sudo apt-get install libgles2-mesa-dev
#
# qmake configuration for building with aarch64-linux-gnu-g++MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublibinclude(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)# modifications to g++.conf
QMAKE_CC = aarch64-linux-gnu-gcc
QMAKE_CXX = aarch64-linux-gnu-g++
QMAKE_LINK = aarch64-linux-gnu-g++
QMAKE_LINK_SHLIB = aarch64-linux-gnu-g++# modifications to linux.confQMAKE_AR = aarch64-linux-gnu-ar cqs
QMAKE_OBJCOPY = aarch64-linux-gnu-objcopy
QMAKE_NM = aarch64-linux-gnu-nm -P
QMAKE_STRIP = aarch64-linux-gnu-stripQMAKE_INCDIR_OPENGL_ES2 = $$[QT_SYSROOT]/usr/include
QMAKE_LIBDIR_OPENGL_ES2 = /usr/lib/aarch64-linux-gnuQMAKE_INCDIR_EGL = $$[QT_SYSROOT]/usr/include
QMAKE_LIBDIR_EGL = /usr/lib/aarch64-linux-gnuQMAKE_LIBS_EGL += -lEGL -lGLESv2
QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL
load(qt_config)