一、安装依赖
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
二、下载riscv-gnu-toolchain
RISCV平台的C/C++交叉编译器
源代码地址:https://github.com/riscv/riscv-gnu-toolchain
riscv工具链整个工程太大,在github下载再递归下载子文件夹,以国内的网络很容易超时断开。一般去码云gitee上面找镜像文件
国内的镜像地址:
git clone https://gitee.com/mirrors/riscv-gnu-toolchain.git
此外,还需要riscv-gnu-toolchain目录下下载下面6个子工程:
https://gitee.com/mirrors/riscv-binutils-gdb.git
https://gitee.com/mirrors/riscv-dejagnu.git
https://gitee.com/mirrors/riscv-gcc.git
https://gitee.com/mirrors/riscv-binutils-gdb.git