环境:Ubuntu 18.04
交叉编译器:gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu
开发板类型:rk3399
1.安装交叉编译器
下载gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
sudo tar jxvf gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
2.设置环境变量
gedit ~/.bashrc
将gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu目录下bin的路径写在文件里
export PATH=$PATH:/用户目录/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin
3.测试交叉编译器是否可用
aarch64-linux-gnu-c++
linux-aarch64-gnu-g++
4.下载QT源码
在QT官网http://download.qt.io/ 下载相应的源码
并解压
sudo tar jxvf gqt-everywhere-src-5.12.2.tar.xz
5.将准备好的build_qt.sh脚本放到QT源码目录
#!/bin/sh
PREFIX=/用户目录/qt5.12.2_aarch64_linux/
SYSROOT=/用户目录/rk3399-build/sysroot
export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/lib/aarch64-linux-gnu/pkgconfig:${SYSR