RISC-V GCC 11.2 Native Build

Asked by John Leidel

I have a SiFive Unmatched system running Ubuntu 21.04. I'm attempting to build a GCC (11.2) from source natively on the platform and I'm running into a series of issues that require multilib support (for rv32 headers/libs). Since 21.04 on RISC-V does not have support for multilib, I'm curious how the Debian/Ubuntu maintainers are building the native RISC-V toolchain? I downloaded the upstream release source from GNU for gcc 11.2.0 and did the following:

$> mkdir objdir
$> $PWD/../gcc/configure --prefix=/share/sw/gcc/11.2.0 --enable-languages=c,c++,fortran,go

This fails to build due to multilib issues. I also tried:

$> $PWD/../configure --prefix=/share/sw/gcc/11.2.0 --target=riscv64-linux --enable-languages=c,c++,fortran,go --disable-multilib

This also fails to build. I'm curious what the respective configuration options are for the Debian-based packaging such that I can replicate with GCC 11.2.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gcc-riscv64-unknown-elf Edit question
Assignee:
No assignee Edit question
Solved by:
John Leidel
Solved:
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

Support for Ubuntu 21.04 has already ended six weeks ago, see https://wiki.ubuntu.com/Releases

Revision history for this message
John Leidel (jleidel) said :
#2

Given the volatility of the current RISC-V hardware platforms, we are unable to upgrade to 21.10. All we need is the build recipe for GCC on RISC-V (be it 21.04 or 21.10).

Revision history for this message
Heinrich Schuchardt (xypron) said :
#3

From your question it is unclear if you need a riscv64 or a riscv32 GCC.

To build a package natively, download the package source with pull-lp-source, e.g.

pull-lp-source gcc-11 impish

Navigate to the gcc-11... directory

Run dpkg-buildpackage.

You may have to build dependencies like binutils first if they don't have the required version.

For Ubuntu Impish prebuilt packages of GCC 11.2 are available.

What stops you from upgrading your build system to 22.04 which will the next long term release?

Revision history for this message
John Leidel (jleidel) said :
#4

Heinrich, we need the riscv64 tool chain. Thanks for the notes on building GCC-11. The system in question is actually a cluster of RISC-V boards (think HPC cluster). As a result, upgrading the "system" implies that we'll need to upgrade all the nodes. There are a number of packages that we were forced to build from scratch. As a result, the process of upgrading would take some time. Once we finish porting some software packages, then we will upgrade the entire machine.