GNU toolchain for RISC-V, including GCC
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Kito Cheng 4910c5a4c5 Add "check-gcc-newlib" to run the GCC test suite 10 years ago
linux-headers/include Bump linux-headers 10 years ago
newlib newlib: add missing cast 10 years ago
patches Start tracking binutils as a submodule 10 years ago
riscv-binutils-gdb@c0c554c504 Enable gdb simulator 10 years ago
riscv-dejagnu@5f3adaf58a Add "check-gcc-newlib" to run the GCC test suite 10 years ago
riscv-gcc@02b9128ac1 bump gcc 10 years ago
riscv-glibc@bce06f4583 Upgrade glibc to 2.24 10 years ago
scripts Avoid wrapping GNU sed/awk on systems where that's the default 11 years ago
.gitignore Centralize GNU utility checks in autoconf 11 years ago
.gitmodules Add "check-gcc-newlib" to run the GCC test suite 10 years ago
.travis.yml Run Travis builds in parallel 10 years ago
LICENSE Add license 10 years ago
Makefile.in Add "check-gcc-newlib" to run the GCC test suite 10 years ago
README.md Add instruction about submodules 10 years ago
configure Add retry flag to curl for bad networks 10 years ago
configure.ac Add retry flag to curl for bad networks 10 years ago

README.md

RISC-V GNU Compiler Toolchain

This is the RISC-V C and C++ cross-compiler. It supports two build modes: a generic ELF/Newlib toolchain and a more sophisticated Linux-ELF/glibc toolchain.

Getting the sources

This repository uses submodules. You need the --recursive option to fetch the submodules automatically

$ git clone --recursive https://github.com/riscv/riscv-gnu-toolchain

Alternatively :

$ git clone https://github.com/riscv/riscv-gnu-toolchain
$ cd riscv-gnu-toolchain
$ git submodule update --init --recursive

Prerequisites

Several standard packages are needed to build the toolchain. On Ubuntu, executing the following command should suffice:

$ 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

On Fedora/CentOS/RHEL OS, executing the following command should suffice:

$ sudo yum install autoconf automake libmpc-devel mpfr-devel gmp-devel gawk  bison flex texinfo patchutils gcc gcc-c++

On OS X, you can use Homebrew to install the dependencies:

$ brew install gawk gnu-sed gmp mpfr libmpc isl

To build the glibc (Linux) on OS X, you will need to build within a case-sensitive file system. The simplest approach is to create and mount a new disk image with a case sensitive format. Make sure that the mount point does not contain spaces. This is not necessary to build newlib or gcc itself on OS X.

This process will start by downloading about 200 MiB of upstream sources, then will patch, build, and install the toolchain. If a local cache of the upstream sources exists in $(DISTDIR), it will be used; the default location is /var/cache/distfiles. Your computer will need about 8 GiB of disk space to complete the process.

Installation (Newlib)

To build the Newlib cross-compiler, pick an install path. If you choose, say, /opt/riscv, then add /opt/riscv/bin to your PATH now. Then, simply run the following command:

./configure --prefix=/opt/riscv
make

You should now be able to use riscv-gcc and its cousins.

Installation (Linux)

To build the Linux cross-compiler, pick an install path. If you choose, say, /opt/riscv, then add /opt/riscv/bin to your PATH now. Then, simply run the following command:

./configure --prefix=/opt/riscv
make linux

Installation (Linux multilib)

To build the Linux cross-compiler with support for both 32-bit and 64-bit, run the following commands:

./configure --prefix=/opt/riscv --enable-multilib
make linux

The multilib compiler will have the prefix riscv-unknown-linux-gnu-, rather than the usual prefix (riscv32-... or riscv64-...).

Advanced Options

There are a number of additional options that may be passed to configure. See './configure --help' for more details.