CLI tool
riscv-collab/riscv-gnu-toolchain avatar
riscv-collab/riscv-gnu-toolchain

riscv-gnu-toolchain: one clone, five C libraries, and a prefix you have to keep clean

GNU toolchain for RISC-V, including GCC

4,667 stars1,423 forksCNOASSERTION

At a glance

What is it?
The RISC-V GNU toolchain is a source build of the C and C++ cross compiler that targets either bare metal or Linux, and the choice of Newlib, Picolibc, glibc, musl or uClibc is made by the make target you build, with a configure flag only changing which one plain make builds. Disk, case sensitivity and a reused prefix directory are the three things that break builds before the compiler is even finished.
Who is it for?
Fit this repository if you need to match a specific C library, ABI or architecture flag rather than accept a generic prebuilt compiler, and if you have room for a multi gigabyte clone and about 8 GiB of disk for the build.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 17 days ago.
What is it written in?
Mainly C, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • riscv-collab/riscv-gnu-toolchain4,667 ★ · +48
Star history
Repository2026-09-232026-11-15
riscv-collab/riscv-gnu-toolchain4.6k4.7k

48 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The clone itself is the biggest download in the process

Getting the sources is one command, and the repository uses submodules that fetch on demand, so neither `--recursive` nor `git submodule update --init --recursive` is needed:

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

The README's warning next to that command is the first fact to plan around: the clone takes around 6.65 GB of disk and download size. After that, the build itself downloads about 200 MiB of upstream sources, patches them, builds, and installs, and the whole process needs about 8 GiB of disk space to complete.

Those upstream sources are cached. If a local cache exists in `$(DISTDIR)` it will be used, and the default location for that cache is `/var/cache/distfiles`. On a machine with limited space that path is worth setting deliberately before the first build, because it is the difference between downloading the same sources once and downloading them once per build attempt.

The top level is a metabuild tree: binutils, gcc, gdb, newlib, picolibc, glibc, musl, uclibc-ng, linux-headers, qemu, spike, llvm, pk, dejagnu, regression, scripts, contrib, test, a configure script generated from configure.ac, and Makefile.in.

The C library is a make target, and the default make target is Newlib

After `./configure --prefix=/opt/riscv` with the prefix on your `PATH`, the C library you get is decided by the target you build:

| C library | build | | -------------- | --------------- | | Newlib | `make` | | Picolibc | `make picolibc` | | Linux (glibc) | `make linux` | | Linux (musl) | `make musl` | | Linux (uClibc) | `make uclibc` |

A plain `make` builds the default target, which is Newlib. To change which library plain `make` produces, configure with `--enable-newlib`, `--enable-linux`, `--enable-musl`, `--enable-uclibc` or `--enable-picolibc`. In other words the libc choice is made twice, once at configure time and once as a make target, and only the configure flag makes it stick as a default.

The prefix shows up in the tool names afterwards. Bare metal tools are prefixed `riscv64-unknown-elf-`, while the Linux tools are prefixed `riscv64-unknown-linux-` followed by `gnu`, `musl` or `uclibc`.

RV64GC is the default even when your build host is 32 bit

The build defaults to targeting RV64GC, and that default holds even on a 32 bit build environment, which is a detail worth knowing before you wonder why a 32 bit host produces 64 bit tools. A 32 bit toolchain takes the architecture and ABI spelled out:

code
./configure --prefix=/opt/riscv --with-arch=rv32gc --with-abi=ilp32d

The supported architectures are rv32i or rv64i plus standard extensions, where the letters stand for atomics, multiplication and division, float, double, or general for MAFD. The supported ABIs are ilp32 for 32 bit soft float, ilp32d for 32 bit hard float, ilp32f for single precision in registers and double in memory, which is marked niche use only, and lp64, lp64f and lp64d for the 64 bit equivalents.

One constraint that bites later rather than earlier: if you plan to use an external library that replaces part of newlib, for example `libgloss-htif`, you need to read the FAQ section on ensuring code model consistency before you build, not after your link fails.

Multilib works for Newlib and glibc and is rejected for the other three

Adding `--enable-multilib` produces runtime libraries for both 32 bit and 64 bit, and the resulting compiler can target both, supporting the most common `-march` and `-mabi` options, which you can see with the `--print-multi-lib` flag:

code
./configure --prefix=/opt/riscv --enable-multilib

The restriction is the part that catches people. Multilib is only available for the Newlib and the Linux glibc toolchains. The musl, uClibc and Picolibc toolchains build a single variant, and configuring them with `--enable-multilib` is rejected outright. Worse, building them explicitly, for example with `make musl`, in a tree that was configured for multilib still yields a single variant, so the configure flag does not even reach them.

Three other configure switches are documented alongside it. `--enable-default-pie` controls default PIE enablement for GCC on the Linux toolchain and is disabled by default. `--with-languages=` sets the enabled languages, for example `./configure --with-languages=c,c++,fortran`, and that option only takes effect for the GNU toolchain. `--enable-strip` controls stripping of host binaries and strip is disabled by default.

macOS builds need a case-sensitive volume, and glibc is the part that insists

The macOS story is split into two. Building newlib or gcc itself on macOS works on a normal volume. Building glibc does not, because it needs a case sensitive file system, and the simplest approach is to create and mount a new disk image with a case sensitive format, making sure the mount point contains no spaces.

On Apple silicon the sequence is specific. Clone into a case sensitive volume, source `macos.zsh` to set up the `PATH` so the build scripts can use the tools from homebrew, then configure, for example:

code
./configure --prefix=/Volumes/case-sensitive/opt/riscv --with-arch=rv64gc_zifencei --with-abi=lp64d --enable-linux --disable-gdb

After that, raise the open file limit with `ulimit -n 65536`. Everywhere the instructions say make, use `gmake` instead so you get the newly installed version.

Builds on macOS are described as highly specific to OS versions and to the versions of the developer tools installed. The recommended first step is `make check-binutils`, which surfaces common build errors without starting a full build, and `./macos-build.md` holds the list of those errors with their fixes.

A reused prefix directory produces a linker error, not a helpful message

The troubleshooting section is blunt: builds work best if installing into an empty directory. If you build a hard float toolchain and then try to build a soft float toolchain with the same `--prefix` directory, the build scripts may get confused and exit with a linker error.

That is the failure mode to plan around, because the symptom does not name its cause. A linker error reads like a broken binutils or a half installed sysroot rather than a dirty install directory, and the usual response is to rebuild a component, which costs hours and changes nothing.

The same applies to big endian targets. Configuring with `./configure --prefix=/opt/riscv --with-endian=big` and then running the target build puts another variant into that directory, so if you also want the default Newlib build next to it, give it a separate prefix.

Prerequisites differ per distribution and macOS needs gmake rather than make

The dependency lists are given per distribution, and on Ubuntu a single command is presented as sufficient:

code
$ sudo apt-get install autoconf automake autotools-dev curl python3 python3-pip python3-tomli libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev meson ninja-build git cmake libglib2.0-dev expect device-tree-compiler libslirp-dev libzstd-dev libncurses-dev

Fedora, CentOS and RHEL get the equivalent `sudo yum install` line, Arch gets a `sudo pacman -Syu` line, and macOS gets a `brew install` line that starts with python3 and gawk. Arch users who would rather not build at all have a binary package on the AUR, named riscv-gnu-toolchain-bin.

On macOS, after the Homebrew install, the README says to use `gmake` instead of `make` so the newly installed version of make is picked up. The list also mentions meson, ninja and cmake, plus device-tree-compiler and libslirp, which are easy to overlook on a minimal image.

Nightly tags ship continuously while the license field asserts nothing

The release history explains how fresh these builds are expected to be. Recent releases are named 2026.10.29, 2026.10.26 and 2026.10.21, each labelled as a nightly build for that day, and the last push on the default branch master is dated 2026-10-29. The repository is not archived, and it carries 4634 stars, 1420 forks and 46 open issues.

A nightly cadence has a consequence for anyone who pins. There is no stable release channel named in that history, so the choice is between a specific dated tag and master.

The other thing to verify before you build for redistribution is licensing. The license field for this repository reads NOASSERTION, so the terms are not a named identifier you can quote, and the tree holds a LICENSE file plus per component directories such as binutils, gcc, gdb, glibc, musl, newlib, picolibc and uclibc-ng, each of which carries its own terms. A company that needs to state a license in a compliance document will have to resolve that from the components rather than from the repository field.

Editorial conclusion

Fit this repository if you need to match a specific C library, ABI or architecture flag rather than accept a generic prebuilt compiler, and if you have room for a multi gigabyte clone and about 8 GiB of disk for the build. Skip it if you only want a working cross compiler quickly, because the README documents a source build (only Arch users get a prebuilt riscv-gnu-toolchain-bin package on the AUR), the project is a metabuild over binutils, gcc, gdb and several libcs, and the license field carries no assertion you can rely on for redistribution.

Frequently asked questions

what is riscv gnu toolchain

It is the RISC-V C and C++ cross compiler, built from source. One tree builds either a bare-metal ELF toolchain using Newlib or Picolibc, or a Linux ELF toolchain using glibc, musl or uClibc, and the result gives you tools prefixed riscv64-unknown-elf- or riscv64-unknown-linux-.

How do I install the RISC-V GNU toolchain?

Clone with `git clone https://github.com/riscv/riscv-gnu-toolchain`, which takes around 6.65 GB of disk and download size, install the prerequisites for your distribution, then run `./configure --prefix=/opt/riscv` with `/opt/riscv/bin` on your PATH and build the C library you want with `make`, `make picolibc`, `make linux`, `make musl` or `make uclibc`.

how to install riscv gnu toolchain

On macOS, use gmake instead of make throughout the build. Pick a writeable prefix such as /opt/riscv, configure with `./configure --prefix=/opt/riscv`, then build your libc target. Keep the prefix directory empty between builds, since reusing one for a hard-float and then a soft-float toolchain can end in a linker error.

What is the GNU toolchain?

In this repository the toolchain is assembled from the components checked into the top level: binutils, gcc, gdb, newlib, picolibc, glibc, musl, uclibc-ng, linux-headers, qemu and spike, driven by a configure script generated from configure.ac and a Makefile.in.

Official sources

  1. Issues
  2. README
  3. Releases
  4. riscv-collab/riscv-gnu-toolchain on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/riscv-collab-riscv-gnu-toolchain.svg)](https://hysenlabs.com/projects/riscv-collab-riscv-gnu-toolchain)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/riscv-collab-riscv-gnu-toolchain.svg)](https://hysenlabs.com/projects/riscv-collab-riscv-gnu-toolchain)

Was this useful?