Since this tool has many dependenciess it's a good idea to build in a docker container. Luckily the tool provides some Dockerfiles which simplifies tracking down said dependencies.
First get the repo. This will take you to master, if you want to play it safe you can checkout a tagged release.
git clone https://github.com/crosstool-ng/crosstool-ng.git
Then build the container. If the distro version you're rocking is not available, choose an older version or create your own Dockerfile. I'll use the 18.04 Dockerfile for my Ubuntu 20.04 PC.
cd crosstool-ng
docker build --network=host --tag crosstool-u18 ./testing/docker/ubuntu18.04
Now you can get in the container and compile. Change the install dir with --prefix
docker run -it --rm -v $PWD:/crosstool-ng crosstool-u18:latest bash
cd crosstool-ng
./bootstrap
./configure --prefix /opt/eriff/crosstool-ng
make all
exit
Now you can install it. You'll have to claim ownership of the files. You may need to remove the folder if there's a previous version already installed.
You can avoid sudo
on the install step if you choose a different prefix.
sudo chown -R $(whoami):$(whoami) .
sudo rm -rf /opt/eriff/crosstool-ng
sudo make install