1****************************************************
2Setup Linux Toolchain from Scratch (Legacy GNU Make)
3****************************************************
4:link_to_translation:`zh_CN:[中文]`
5
6.. include:: ../gnu-make-legacy.rst
7
8.. note::
9
10    Standard process for installing the toolchain is described :doc:`here <linux-setup>`. See :ref:`Customized Setup of Toolchain <get-started-customized-setup-legacy>` section for some of the reasons why installing the toolchain from scratch may be necessary.
11
12Install Prerequisites
13=====================
14
15To compile with ESP-IDF you need to get the following packages:
16
17- Ubuntu and Debian::
18
19    sudo apt-get install gcc git wget make libncurses-dev flex bison gperf python python-pip python-setuptools python-serial python-cryptography python-future python-pyparsing python-pyelftools libffi-dev libssl-dev
20
21- Arch::
22
23    sudo pacman -S --needed gcc git make ncurses flex bison gperf python-pyserial python-cryptography python-future python-pyparsing python-pyelftools
24
25.. note::
26
27    Some older (pre-2014) Linux distributions may use ``pyserial`` version 2.x which is not supported by ESP-IDF.
28    In this case please install a supported version via ``pip`` as it is described in section
29    :ref:`get-started-get-packages-legacy`.
30
31Compile the Toolchain from Source
32=================================
33
34- Install dependencies:
35
36  - CentOS 7::
37
38        sudo yum install gawk gperf grep gettext ncurses-devel python python-devel automake bison flex texinfo help2man libtool
39
40  - Ubuntu pre-16.04::
41
42        sudo apt-get install gawk gperf grep gettext libncurses-dev python python-dev automake bison flex texinfo help2man libtool
43
44  - Ubuntu 16.04 or newer::
45
46        sudo apt-get install gawk gperf grep gettext python python-dev automake bison flex texinfo help2man libtool libtool-bin
47
48  - Debian 9::
49
50        sudo apt-get install gawk gperf grep gettext libncurses-dev python python-dev automake bison flex texinfo help2man libtool libtool-bin
51
52  - Arch::
53
54        TODO
55
56Create the working directory and go into it::
57
58  mkdir -p ~/esp
59  cd ~/esp
60
61Download ``crosstool-NG`` and build it:
62
63.. include-build-file:: inc/scratch-build-code.inc
64
65Build the toolchain::
66
67    ./ct-ng xtensa-esp32-elf
68    ./ct-ng build
69    chmod -R u+w builds/xtensa-esp32-elf
70
71Toolchain will be built in ``~/esp/crosstool-NG/builds/xtensa-esp32-elf``. Follow :ref:`instructions for standard setup <setup-linux-toolchain-add-it-to-path-legacy>` to add the toolchain to your ``PATH``.
72
73
74Next Steps
75==========
76
77To carry on with development environment setup, proceed to section :ref:`get-started-get-esp-idf-legacy`.
78