centos7 镜像
下载地址:http://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/
aarch64交叉编译链
下载地址:https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/
QT5.9.9源代码
下载地址:https://download.qt.io/new_archive/qt/5.9/5.9.9/single/
找源码找了半个小时
安装工具包
yum install -y gcc gcc-c++
yum -y install centos-release-sclyum -y install devtoolset-7-gcc devtoolset-7-gcc-c++ devtoolset-7-binutilsyum install devtoolset-7-libcilkrts-develscl enable devtoolset-7 bash
yum install -y fontconfig freetype freetype-devel mesa-libGL-devel mesa-libGLU-devel freeglut-devel libXext-devel libXfixes-devel libXi-devel libXrender-devel libxcb-devel libX11-devel libxkbcommon-x11-devel gstreamer* libgstreamer* zlib zlib-devel
yum install bison build-essential gperf flex ruby python libasound2-dev libbz2-dev libcap-dev libcups2-dev libdrm-dev libegl1-mesa-dev libgcrypt11-dev libnss3-dev libpci-dev libpulse-dev libudev-dev libxtst-dev gyp ninja-build libglu1-mesa-dev libfontconfig1-dev libx11-xcb-dev libicu-dev
配置交叉编译工具链
直接解压即可
配置环境变量,在/etc/profile最下面加入如下一段,其中路径根据自己的实际路径填写
export PATH=$PATH:/home/zhangdy/source_code/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin
验证时,输入aarch,然后多按几次tab键,出现提示表示配置成功
编译QT5.9.9源码
解压源码之后,进入目录,输入如下命令,用于生成Makefile,如果想要静态编译,将-shared换成-static
./configure -verbose -opensource -release -shared -confirm-license -make libs -nomake tests -nomake examples -skip qtmacextras -skip qtandroidextras -qt-sqlite -qt-pcre -qt-zlib -qt-libpng -qt-libjpeg -no-opengl -xplatform linux-aarch64-gnu-g++ -prefix /opt/qt5.9.9-aarch64
输入以下命令正式开始编译
make -j8
最后执行如下命令,qt就会安装到/opt/qt5.9.9-aarch64,之前指定的目录
make install
关于交叉编译工具链起作用的环节
-xplatform linux-aarch64-gnu-g++
关于配置环境变量要注意的事项
export PATH=$PATH:/home/zhangdy/source_code/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin
$PATH: 一定要写,不然会出现系统命令失效的问题