The Orion toolchain is based on GCC and Binutils, since they're both free and open-source, and support all the features needed to compile the system.
Depending what system you're running, you'll need to install some prerequisite tools to enable you to build both packages.
You need to install Nasm, Texinfo, Flex, Bison, GMP, MPC and MPFR, all of which can be found through your package manager.
In Arch:
sudo pacman -S base-devel gmp libmpc mpfr mtools nasm
In Debian:
sudo apt-get install build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo
GCC and Binutils both rely on autotools to configure the build, so you'll need to install the correct version of autoconf and automake.
The current versions used in the Orion toolchain are GCC 12.2.0 and Binutils 2.39, which both need autoconf 2.69 and automake 1.15.1.
You can install both of them by building from source easily:
wget https://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
wget https://ftp.gnu.org/gnu/automake/automake-1.15.1.tar.gz
tar zxvf autoconf-2.69.tar.gz
tar zxvf automake-1.15.1.tar.gz
cd autoconf-2.69
./configure
make
sudo make install
cd ../automake-1.15.1
./configure
make
sudo make install
cd ..
rm -rf auto*
Similarly you'll want to download the GCC and Binutils source code:
wget https://ftp.gnu.org/gnu/gcc/gcc-12.2.0/gcc-12.2.0.tar.gz
wget https://ftp.gnu.org/gnu/binutils/binutils-2.39.tar.gz
tar zxvf gcc-12.2.0.tar.gz
tar zxvf binutils-2.39.tar.gz
rm *.tar.gz
Before you build the sources, you need to configure them for the build.
Part of this process includes selecting the machine they'll target.
The Orion toolchain will need to target Orion, and even though the kernel may be built freestanding it still needs stdint.h
from the target.
GCC and Binutils do not support Orion out of the box, so you can patch in support with the following commands:
wget https://files.barrsyerver.net/orion/binutils.patch
wget https://files.barryserver.net/orion/gcc.patch
patch -t -p 0 < binutils.patch
patch -t -p 0 < gcc.patch
cd binutils-2.39/ld/
automake
cd ../../gcc-12.2.0/libstdc++-v3/
autoconf
cd ../../
Finally to build GCC and Binutils for Orion:
mkdir -p binutils-orion-build
cd binutils-orion-build
../binutils-2.39/configure --target=i686-orion --with-sysroot=$SYSROOT --disable-nls --disable-werror
make
sudo make install
cd ..
mkdir -p gcc-orion-build
cd gcc-orion-build
../gcc-12.2.0/configure --target=i686-orion --disable-nls --enable-languages=c --with-sysroot=$SYSROOT
make all-gcc
make all-target-libgcc
sudo make install-gcc
sudo make install-target-libgcc
cd ..
You should now be able to invoke the i686-orion-*
suite of tools.