I'm in the process of developing a native toolchain for my RISC-V Evaluation board. Currently, I have a cross-compiler provided by the vendor and a corresponding sysroot for the same board.
Given my limited knowledge in toolchain building, I'm seeking some guidance or steps on how to create the native toolchain using these components.
This is the steps it tried to build the natieve compiler for the riscv64.
host system : ubuntu 18.04LTS ( docker inside our build PC ). cross-compiler: riscv64-linux-gnu- (installed from apt repository.) also tried the evaluation board's cross-compiler from their Board support packages.
STEP 1:
$git clone git://gcc.gnu.org/git/gcc.git
STEP 2:
$git checkout releases/gcc-7.5.0
STEP 3: followed the steps from https://gcc.gnu.org/wiki/InstallingGCC to install prerequisites
$cd gcc && ./contrib/download_prerequisites
STEP 4:
$mkdir objdir
STEP 5:
$cd objdir
STEP 6:
objdir$../gcc/configure --prefix="path/for/output/GCC-7.5.0/" --with-build-sysroot="path/to/evaluation_board_bsp/sysroot" --build=x86_64-pc-linux --host=riscv64-linux-gnu --target=riscv64-linux-gnu --enable-languages=c,c++
STEP 7:
make
Error log: ( last few lines )
checking whether we are using the GNU C compiler... yes
checking whether riscv64-linux-gnu-gcc accepts -g... yes
checking for riscv64-linux-gnu-gcc option to accept ISO C89... none needed
checking whether riscv64-linux-gnu-gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of riscv64-linux-gnu-gcc... gcc3
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking for C compiler vendor... gnu
checking build system type... x86_64-pc-linux-gnu
checking host system type... Invalid configuration `riscv64-linux-gnu': machine `riscv64' not recognized
configure: error: /bin/sh ../../gcc/isl/./config.sub riscv64-linux-gnu failed
Makefile:5987: recipe for target 'configure-isl' failed
make[1]: *** [configure-isl] Error 1
make[1]: Leaving directory '/mnt/file_from_host/gcc_for_risc_try_2/objdir'
Makefile:900: recipe for target 'all' failed
make: *** [all] Error 2
I didn't understand this line from the error log. how to solve this part.
checking host system type... Invalid configuration `riscv64-linux-gnu': machine `riscv64' not recognized
Some comments which are not directly related to the question: The reason I'm not using the cross-compiler is that I need to build the Gsoap library. It's the only package I couldn't cross-compile because it has 2 stages in the build and the 2nd stage should run in risc-v platform to continue the build. Furthermore, the rootfs of the board only have glibc version 2.27, making it challenging to find any prebuilt rootfs with this specific glibc version. Therefore, building a native toolchain seems to be the only viable option.