Cross compiler riscv64 building

David Brown david@westcontrol.com
Wed Feb 8 12:45:10 GMT 2023


On 08/02/2023 12:11, Sagar Acharya via Gcc-help wrote:
> How do I configure and build a cross compiler for target riscv64 of latest gcc on aarch64 musl based void linux.
> 
> I have it's default gcc installed which I want to use for compiling.
> Thanking you
> Sagar Acharya
> https://designman.org
> 

For many people, a better option is to use pre-built binaries.  Getting 
a complete toolchain for cross-development is a fair bit of work, and 
can involve a lot of trial and error and research.  The compiler, gcc, 
is just one part of the job (albeit a big part) - you have binutils, 
libraries, debuggers, and perhaps other bits and pieces.  It can be an 
educational and - if you like that sort of thing - enjoyable task.  But 
it can also be frustrating and time-consuming.  And if your ARM host 
here is a small system (say, a Raspberry Pi rather than an Ampere Altra 
monster), toolchain builds can take a /long/ time.

I have no experience with RISC-V as yet (one day, I hope to use them), 
but it looks like you might get what you need from here : 
<https://xpack.github.io/dev-tools/riscv-none-elf-gcc/>.

(I work mostly with ARM microcontrollers and use ARM's "GNU ARM 
Embedded" toolchains, rather than xPack's.)

I've done more than my fair share of cross-gcc toolchain builds over the 
decades, but for most purposes, ready-built packages make life a lot easier.



More information about the Gcc-help mailing list