1*******************************************************
2Standard Setup of Toolchain for Linux (Legacy GNU Make)
3*******************************************************
4:link_to_translation:`zh_CN:[中文]`
5
6.. include:: ../gnu-make-legacy.rst
7
8Install Prerequisites
9=====================
10
11To compile with ESP-IDF you need to get the following packages:
12
13- CentOS 7::
14
15    sudo yum install gcc git wget make flex bison gperf python python2-cryptography
16
17- Ubuntu and Debian::
18
19    sudo apt-get install gcc git wget make 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 flex bison gperf python-pyserial python-cryptography python-future python-pyparsing python-pyelftools
24
25.. note::
26
27    Some older Linux distributions may be missing some of the Python packages listed above (or may use ``pyserial`` version 2.x which is not supported by ESP-IDF). It is possible to install these packages via ``pip`` instead - as described in section :ref:`get-started-get-packages-legacy`.
28
29Toolchain Setup
30===============
31
32.. include-build-file:: inc/download-links.inc
33
34ESP32 toolchain for Linux is available for download from Espressif website:
35
36- for 64-bit Linux:
37
38  |download_link_linux64|
39
40- for 32-bit Linux:
41
42  |download_link_linux32|
43
441.  Download this file, then extract it in ``~/esp`` directory:
45
46    - for 64-bit Linux:
47
48      .. include-build-file:: inc/unpack-code-linux64.inc
49
50    - for 32-bit Linux:
51
52      .. include-build-file:: inc/unpack-code-linux32.inc
53
54.. _setup-linux-toolchain-add-it-to-path-legacy:
55
562.  The toolchain will be extracted into ``~/esp/xtensa-esp32-elf/`` directory.
57
58    To use it, you will need to update your ``PATH`` environment variable in ``~/.profile`` file. To make ``xtensa-esp32-elf`` available for all terminal sessions, add the following line to your ``~/.profile`` file::
59
60        export PATH="$HOME/esp/xtensa-esp32-elf/bin:$PATH"
61
62    Alternatively, you may create an alias for the above command. This way you can get the toolchain only when you need it. To do this, add different line to your ``~/.profile`` file::
63
64        alias get_esp32='export PATH="$HOME/esp/xtensa-esp32-elf/bin:$PATH"'
65
66    Then when you need the toolchain you can type ``get_esp32`` on the command line and the toolchain will be added to your ``PATH``.
67
68    .. note::
69
70        If you have ``/bin/bash`` set as login shell, and both ``.bash_profile`` and ``.profile`` exist, then update ``.bash_profile`` instead. In CentOS, ``alias`` should set in ``.bashrc``.
71
723.  Log off and log in back to make the ``.profile`` changes effective. Run the following command to verify if ``PATH`` is correctly set::
73
74        printenv PATH
75
76    You are looking for similar result containing toolchain's path at the beginning of displayed string::
77
78        $ printenv PATH
79        /home/user-name/esp/xtensa-esp32-elf/bin:/home/user-name/bin:/home/user-name/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
80
81    Instead of ``/home/user-name`` there should be a home path specific to your installation.
82
83
84Permission issues /dev/ttyUSB0
85------------------------------
86
87With some Linux distributions you may get the ``Failed to open port /dev/ttyUSB0`` error message when flashing the ESP32. :ref:`This can be solved by adding the current user to the dialout group<linux-dialout-group-legacy>`.
88
89Next Steps
90==========
91
92To carry on with development environment setup, proceed to section :ref:`get-started-get-esp-idf-legacy`.
93
94
95Related Documents
96=================
97
98.. toctree::
99    :maxdepth: 1
100
101    linux-setup-scratch
102
103
104.. _AUR: https://wiki.archlinux.org/index.php/Arch_User_Repository
105