https://github.com/nihui/riscv-v-toolchain
prebuild package for cross compiling riscv
https://github.com/nihui/riscv-v-toolchain
Last synced: over 1 year ago
JSON representation
prebuild package for cross compiling riscv
- Host: GitHub
- URL: https://github.com/nihui/riscv-v-toolchain
- Owner: nihui
- Created: 2021-12-28T02:31:17.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-12-28T02:51:28.000Z (over 4 years ago)
- Last Synced: 2025-03-30T03:44:10.613Z (over 1 year ago)
- Size: 2.93 KB
- Stars: 18
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Build the latest riscv toolchain with v and zfh extension on ubuntu 20.04.3
You need to build qemu from the git for running the binary
```shell
# install build requirements
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev curl python3 libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev device-tree-compiler
git clone https://github.com/riscv/riscv-gnu-toolchain.git
cd riscv-gnu-toolchain
git checkout 28271f03bb538d926ad2889dc8ad1b0cb1b3b45c
git submodule update --init --recursive --depth 1 riscv-binutils
git submodule update --init --recursive --depth 1 riscv-glibc
git submodule update --init --recursive --depth 1 riscv-dejagnu
git submodule update --init --recursive --depth 1 riscv-newlib
git submodule update --init --recursive --depth 1 riscv-gdb
# upgrade the riscv-gcc folder manually
rm -rf riscv-gcc
git clone -b riscv-gcc-10.1-rvv-dev --single-branch --depth=1 https://github.com/riscv-collab/riscv-gcc.git
# revert vfredsum -> vfredusum changes for compatibility atm
pushd riscv-gcc
wget https://github.com/riscv-collab/riscv-gcc/commit/227d14bbdbcef65cc3f8ea96e6e3fb905d32368f.patch
patch -p1 -R -i 227d14bbdbcef65cc3f8ea96e6e3fb905d32368f.patch
popd
# fix compile error
sed -i '/__OBSOLETE_MATH/d' riscv-newlib/newlib/libm/common/math_errf.c
# build toolchain, you need at least 20GB free memory for 4 parallel jobs
./configure --prefix=`pwd`/rv64gcv-install --with-arch=rv64gcv_zfh
make linux -j 4
# strip debug symbols
find rv64gcv-install -type f | xargs -i strip -g {} || true
# fix sysroot/lib/tls missing error
pushd rv64gcv-install/sysroot/lib
ln -s ./ tls
popd
zip -9 --symlinks -r rv64gcv-install.zip rv64gcv-install
```