- Install MinGW packages on Ubuntu
sudo apt install mingw-w64
-
Download, build and install GMP for MinGW
- Download the src package from https://sourceforge.net/projects/mingw/files/MinGW/Base/gmp/gmp-6.1.2/
- Extract somewhere on your Ubuntu machine and enter the directory.
- Run
./configure --prefix=/usr/x86_64-w64-mingw32 --host=x86_64-w64-mingw32
make
sudo make install
-
Download, build and install mpfr for MinGW
- Download the src package from https://sourceforge.net/projects/mingw/files/MinGW/Base/mpfr/mpfr-3.1.5/
- Extract somewhere on your Ubuntu machine and enter the directory.
- Run
./configure --prefix=/usr/x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-static --disable-shared
make
sudo make install
-
Download, build and install mpc for MinGW
- Download the src package from https://sourceforge.net/projects/mingw/files/MinGW/Base/mpc/mpc-1.0.1/
- Extract somewhere on your Ubuntu machine and enter the directory
- Run
./configure --prefix=/usr/x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-static --disable-shared
make
sudo make install
-
Build riscv-gnu-toolchain
- Clone the repository from https://github.com/riscv/riscv-gnu-toolchain
- Enter the directory and configure the build with
./configure --prefix=<absolute path of toolchain install dir> --with-arch=<you arch of choice> --with-abi=<your ABI of choice> --with-host=x86_64-w64-mingw32 --without-system-zlib
make
- Wait and hope everything builds fine... :)