Skip to content

Instantly share code, notes, and snippets.

@ericriff
Last active May 11, 2022 00:51
Show Gist options
  • Save ericriff/149f0f04675f74c7ca18e5dd2ddb6c5f to your computer and use it in GitHub Desktop.
Save ericriff/149f0f04675f74c7ca18e5dd2ddb6c5f to your computer and use it in GitHub Desktop.
How to build crosstool-ng from sources using the provided Dockerfiles

How to build crosstool-ng from sources using the provided Dockerfiles.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment