Anatomy of a toolchain
To get an idea of what is in a typical toolchain, let’s examine the toolchain you downloaded from Bootlin. The examples use the aarch64 toolchain, which has the prefix aarch64-buildroot-linux-gnu
.
The aarch64 toolchain is in the directory ~/aarch64--glibc--stable-2024.02-1/bin
. In there, you will find the cross compiler aarch64-buildroot-linux-gnu-gcc
. To make use of it, you need to add the directory to your path using the following command:
$ PATH=~/aarch64--glibc--stable-2024.02-1/bin:$PATH
If you downloaded a different version, make sure to replace 2024.02-1
with the actual version of the stable toolchain.
Now you can take a simple helloworld
program, which, in the C language, looks like this:
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[])
{
printf ("Hello, World!\n");
return 0;
}
And compile it like this:
$ aarch64-buildroot-linux-gnu-gcc helloworld.c -o helloworld...