macos-setup-scratch.rst 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ***************************************
  2. Setup Toolchain for Mac OS from Scratch
  3. ***************************************
  4. :link_to_translation:`zh_CN:[中文]`
  5. .. note::
  6. Standard process for installing the toolchain is described :doc:`here <macos-setup>`. See :ref:`Customized Setup of Toolchain <get-started-customized-setup>` section for some of the reasons why installing the toolchain from scratch may be necessary.
  7. Install Prerequisites
  8. =====================
  9. - install pip::
  10. sudo easy_install pip
  11. .. note::
  12. ``pip`` will be used later for installing :ref:`the required Python packages <get-started-get-packages>`.
  13. Compile the Toolchain from Source
  14. =================================
  15. - Install dependencies:
  16. - Install either MacPorts_ or homebrew_ package manager. MacPorts needs a full XCode installation, while homebrew only needs XCode command line tools.
  17. .. _homebrew: https://brew.sh/
  18. .. _MacPorts: https://www.macports.org/install.php
  19. - with MacPorts::
  20. sudo port install gsed gawk binutils gperf grep gettext wget libtool autoconf automake
  21. - with homebrew::
  22. brew install gnu-sed gawk binutils gperftools gettext wget help2man libtool autoconf automake
  23. Create a case-sensitive filesystem image::
  24. hdiutil create ~/esp/crosstool.dmg -volname "ctng" -size 10g -fs "Case-sensitive HFS+"
  25. Mount it::
  26. hdiutil mount ~/esp/crosstool.dmg
  27. Create a symlink to your work directory::
  28. mkdir -p ~/esp
  29. ln -s /Volumes/ctng ~/esp/ctng-volume
  30. Go into the newly created directory::
  31. cd ~/esp/ctng-volume
  32. Download ``crosstool-NG`` and build it:
  33. .. include:: /_build/inc/scratch-build-code.inc
  34. Build the toolchain::
  35. ./ct-ng xtensa-esp32-elf
  36. ./ct-ng build
  37. chmod -R u+w builds/xtensa-esp32-elf
  38. Toolchain will be built in ``~/esp/ctng-volume/crosstool-NG/builds/xtensa-esp32-elf``. Follow :ref:`instructions for standard setup <setup-macos-toolchain-add-it-to-path>` to add the toolchain to your ``PATH``.
  39. Python 2 deprecation
  40. ====================
  41. Python 2 reached its `end of life <https://www.python.org/doc/sunset-python-2/>`_ and support for it in ESP-IDF will be removed soon. Please install Python 3.6 or higher. Instructions for macOS are listed above.
  42. Next Steps
  43. ==========
  44. To carry on with development environment setup, proceed to section :ref:`get-started-get-esp-idf`.