Customized Setup of Toolchain (Legacy GNU Make)
Instead of downloading binary toolchain from Espressif website (see Step 1. Set up the Toolchain) you may build the toolchain yourself.
Since ESP-IDF V4.0, the default build system is based on CMake. This documentation is for the legacy build system based on GNU Make. Support for this build system may be removed in future major releases.
If you can’t think of a reason why you need to build it yourself, then probably it’s better to stick with the binary version. However, here are some of the reasons why you might want to compile it from source:
if you want to customize toolchain build configuration
if you want to use a different GCC version (such as 4.8.5)
if you want to hack gcc or newlib or libstdc++
if you are curious and/or have time to spare
if you don’t trust binaries downloaded from the Internet
In any case, here are the instructions to compile the toolchain yourself.