1安装依赖
sudo apt-get install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev
sudo apt-get install libnewlib-dev
2下载riscv-gnu-toolchain
①下载gnu
git clone https://gitee.com/mirrors/riscv-gnu-toolchain.git
② 下载子模块
cd riscv-gnu-toolchain
git clone --recursive https://gitee.com/mirrors/riscv-binutils-gdb.git ./binutils
git clone --recursive https://gitee.com/mirrors/riscv-gcc.git ./gcc
git clone --recursive https://gitee.com/mirrors/riscv-glibc.git ./glibc 没有就用下面的(readme.md中有说明)
#git clone git://sourceware.org/git/glibc.git ; git checkout 89d3d81 当时编译,这个版本才能过,否则报错gnu版本太低
git clone --recursive https://gitee.com/mirrors/riscv-dejagnu ./dejagnu
git clone --recursive https://gitee.com/mirrors/riscv-newlib.git ./newlib
git clone --recursive https://gitee.com/mirrors/riscv-binutils-gdb.git ./gdb
git clone https://mirrors.tuna.tsinghua.edu.cn/git/qemu.git ./qemu 不运行可不安装,在目标机运行
③ 编译 Linux 的交叉工具链
mkdir build
cd build
../configure --prefix=/opt/riscv
sudo make -j8 // 适用于裸机开发(无操作系统支持)
sudo make linux -j12 // 适用于linux
3编译qt源码
下载qt源码,本例程使用 qt-everywhere-src-5.15.2 ,请自行下载并解压
①修改qt配置文件