I did apt-get install gcc-arm-linux-gnueabi
to install cross-compile toolchain for arm. This installed version 4.7 for me. Later I had to install at least version 5 to compile a specific version of kernel, so I did apt-get install gcc-5-arm-linux-gnueabi
. To switch between the above 2 versions of each of the included binaries, I had to install setup for update-alternatives
.
Now again I am facing a situation where I have to do install version 7 of toolchain. I have downloaded the package from linaro website (link) which is a tar package. Now it has around 20 binaries and I believe all of them should be installed together (i.e. -gcc, -g++, -as, etc should be default from this package together). Now I really don't want to install update-alternatives
for each of them one by one. Neither do I put all of them in the /usr/bin
folder and overwrite the other 2 versions of binaries.
What is the best practice to maintain all 3 toolchain environments together?
In general, you can keep your toolchains in separate directories (e.g. /usr/bin/{v4, v6, v7}. Then, you can either have your shell's $PATH
include those directories directly, or (in the case of the Linux kernel and many other projects), just set the CROSS_COMPILE
environment variable as you build.
For example, to build with v6:
make CROSS_COMPILE=/usr/bin/v6/arm-gnueabi-
And v7:
make CROSS_COMPILE=/usr/bin/v7/arm-gnuabi-
Typically, one wouldn't make subdirectories within /usr/bin
, so maybe you'd want to install the toolchains somewhere like /opt/arm-toolchains/vN/
.