【Odroid C4】交叉编译工具链安装以及QT交叉编译环境搭建
虚拟机环境,UBUNTU20.04
文章目录
- 【Odroid C4】交叉编译工具链安装以及QT交叉编译环境搭建
- 一、Odroid C4交叉编译工具链安装
- 二、QT下载及编译安装
- 1.QT下载
- 2.交叉编译QT
- 配置QtCreator可以[参考](https://blog.csdn.net/weixin_49513223/article/details/131943975?spm=1001.2014.3001.5502)
- 总结
一、Odroid C4交叉编译工具链安装
参考ODROID Wiki
- 安装相关依赖:
sudo apt-get update
sudo apt-get install git lzop build-essential gcc bc libncurses5-dev libc6-i386 lib32stdc++6 zlib1g:i386
- 在这里下载ToolChain
- 解压到期望的路径,比如 /opt/toolchains/
sudo mkdir -p /opt/toolchains
sudo tar Jxvf gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz -C /opt/toolchains
- 添加环境变量到 ~/.bashrc
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
export PATH=/opt/toolchains/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/:$PATH
- 更新一下
source ~/.bashrc
到这里安装就完成了
检查一下是否能用
aarch64-linux-gnu-gcc -v
输出结果类似下面这样:
使用内建 specs。
COLLECT_GCC=aarch64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/opt/toolchains/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/../libexec/gcc/aarch64-linux-gnu/7.5.0/lto-wrapper
目标:aarch64-linux-gnu
配置为:'/home/tcwg-buildslave/workspace/tcwg-make-release_0/snapshots/gcc.git~linaro-7.5-2019.12/configure' SHELL=/bin/bash --with-mpc=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/builds/destdir/x86_64-unknown-linux-gnu --with-mpfr=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gmp=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld --disable-libmudflap --enable-lto --enable-shared --without-included-gettext --enable-nls --with-system-zlib --disable-sjlj-exceptions --enable-gnu-unique-object --enable-linker-build-id --disable-libstdcxx-pch --enable-c99 --enable-clocale=gnu --enable-libstdcxx-debug --enable-long-long --with-cloog=no --with-ppl=no --with-isl=no --disable-multilib --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419 --with-arch=armv8-a --enable-threads=posix --enable-multiarch --enable-libstdcxx-time=yes --enable-gnu-indirect-function --with-build-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/sysroots/aarch64-linux-gnu --with-sysroot=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/builds/destdir/x86_64-unknown-linux-gnu/aarch64-linux-gnu/libc --enable-checking=release --disable-bootstrap --enable-languages=c,c++,fortran,lto --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=aarch64-linux-gnu --prefix=/home/tcwg-buildslave/workspace/tcwg-make-release_0/_build/builds/destdir/x86_64-unknown-linux-gnu
线程模型:posix
gcc 版本 7.5.0 (Linaro GCC 7.5-2019.12)
二、QT下载及编译安装
1.QT下载
下载链接
以5.15.8版本为例
下载完成后,解压
2.交叉编译QT
- 更改配置文件:
cd xx/qt-everywhere-src-5.15.8/qtbase/mkspecs/
cp -rf ./linux-aarch64-gnu-g++ ./aarch64-linux-gnu-g++ #这里是为了对应到xplatform,名字无所谓啦
cd aarch64-linux-gnu-g++/
sudo vim qmake.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++
- 执行命令
./configure -prefix ~/qt5.15.8_Odroid/ -opensource -confirm-license -release -strip -no-eglfs -linuxfb -qt-zlib -no-gif -qt-libpng -qt-libjpeg -qt-freetype -no-rpath -no-pch -no-avx -no-openssl -no-cups -no-dbus -no-pkg-config -no-glib -no-iconv -xplatform aarch64-linux-gnu-g++ -no-opengl -nomake examples -nomake tools -no-sqlite -skip qtgamepad -skip qtandroidextras -skip qtmacextras -skip qtx11extras -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtwebengine -skip qtwebchannel -skip qtwebsockets -skip qtlocation -skip qtquickcontrols -skip qtpurchasing -skip qtconnectivity -skip qtscxml -skip qtxmlpatterns -skip qtnetworkauth -skip qtspeech -skip qtscript -skip qtremoteobjects -skip qtcharts -skip qtdatavis3d -skip qtwebview
make -j8 && make install
配置QtCreator可以参考
总结
一坑(hisi)未平,一坑(Odroid C4)又起……
学吧,都是芝士( ̄▽ ̄ =  ̄︿ ̄)