Cross compiling for RISC-V on Ubuntu

Since GCC already has the capability to cross-compile for RISC-V, I am wondering how I can set up GCC to compile for RISC-V and if there any sample make file or setup to show how to do this.

There may be better alternatives out there, but I’ve been using Microchip’s PolarFire SoC Buildroot SDK (available on GitHub), which produces a RISC-V GCC cross-compiler during the build process.

Hi @mans

SoftConsole includes the RISC-V GCC compiler and bundles some example projects which build for RISC-V if your target is bare metal?

gcc provides a good option for cross compilation, another best solution you could use is with meson build as it handles all the cross compilation in back end and its simple to use.

Can you please provide some information about meson build? any link?
here you go,
When you are working with docker or Yocto especially it very good