Troubles building cross-compiler; target 64-bit RISC-V
Mon Aug 5 21:23:00 GMT 2019
On Mon, Aug 5, 2019 at 12:22 PM <email@example.com> wrote:
> I have deleted everything in my build directory. Then I ran configure again. The thing is my binutils are named riscv64-ar, riscv64-as, riscv64-ld not riscv64-elf-ar, riscv64-elf-as etc. It seems it is default behavior. How do I tell configure it should use these?
As Segher mentioned, the configure arguments for binutils need to be
the same as for gcc, the --target, --prefix, --program-prefix at least
need to be the same, but it is simplest to make all of the binutils
and gcc configure arguments the same. You should explicitly specify
--target rather than rely on binutils and gcc to use the same default.
Otherwise there is no way for binutils and gcc to know whether you are
building a linux toolchain or an embedded toolchain or a rtems
toolchain, etc. Presumably you want riscv64-elf or
riscv64-unknown-elf. You don't need to put the $PREFIX/bin on your
path during the build, gcc configure will look there automatically.
There are various scripts you can use to make building a toolchain
easier. crosstool-ng is a popular one, enable the experimental
support to get the RISC-V support. There is also
github.com/riscv/riscv-gnu-toolchain which is RISC-V specific.
More information about the Gcc-help