天天看點

【問題解決】ESP32報錯:make: xtensa-esp32-elf-gcc: Command not found問題:分析:解決:

問題:

make menuconfig

執行報錯:

Python requirements from /home/pjw/ESP32/esp-idf/requirements.txt are satisfied.
DEFCONFIG
MENUCONFIG


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

GENCONFIG
make: xtensa-esp32-elf-gcc: Command not found
expr: 文法錯誤
Project is not inside a git repository, will not use 'git describe' to determine PROJECT_VER.
App "hello-world" version: 1
make: xtensa-esp32-elf-gcc: Command not found
expr: 文法錯誤
/bin/sh: xtensa-esp32-elf-gcc:未找到指令
/bin/sh: xtensa-esp32-elf-gcc:未找到指令
           

分析:

執行

./install.sh

的LOG:

Installing ESP-IDF tools
Installing tools: xtensa-esp32-elf, esp32ulp-elf, openocd-esp32
Installing [email protected]
Downloading xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz to /home/pjw/.espressif/dist/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz.tmp
Done
Extracting /home/pjw/.espressif/dist/xtensa-esp32-elf-gcc8_4_0-esp-2020r3-linux-amd64.tar.gz to /home/pjw/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0
Installing [email protected]
Downloading binutils-esp32ulp-linux64-2.28.51-esp32ulp-20180809.tar.gz to /home/pjw/.espressif/dist/binutils-esp32ulp-linux64-2.28.51-esp32ulp-20180809.tar.gz.tmp
Done
Extracting /home/pjw/.espressif/dist/binutils-esp32ulp-linux64-2.28.51-esp32ulp-20180809.tar.gz to /home/pjw/.espressif/tools/esp32ulp-elf/2.28.51.20170517
Installing [email protected]
Downloading openocd-esp32-linux64-0.10.0-esp32-20200709.tar.gz to /home/pjw/.espressif/dist/openocd-esp32-linux64-0.10.0-esp32-20200709.tar.gz.tmp
Done
Extracting /home/pjw/.espressif/dist/openocd-esp32-linux64-0.10.0-esp32-20200709.tar.gz to /home/pjw/.espressif/tools/openocd-esp32/v0.10.0-esp32-20200709
           

執行

. ./export.sh

的LOG

Adding ESP-IDF tools to PATH...
Checking if Python packages are up to date...
Python requirements from /home/pjw/ESP32/esp-idf/requirements.txt are satisfied.
Added the following directories to PATH:
  /home/pjw/ESP32/esp-idf/components/esptool_py/esptool
  /home/pjw/ESP32/esp-idf/components/espcoredump
  /home/pjw/ESP32/esp-idf/components/partition_table/
  /home/pjw/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin
  /home/pjw/.espressif/tools/esp32ulp-elf/2.28.51.20170517/esp32ulp-elf-binutils/bin
  /home/pjw/.espressif/tools/openocd-esp32/v0.10.0-esp32-20200709/openocd-esp32/bin
  /home/pjw/.espressif/python_env/idf4.0_py3.8_env/bin
  /home/pjw/ESP32/esp-idf/tools
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:

  idf.py build
  
           

發現

xtensa-esp32-elf

已經下載下傳并且添加到

PATH

了。

查詢

PATH

環境,沒有找到:

解決:

手動添加環境變量

vim ~/.bashrc
export PATH=~/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin:$PATH
source ~/.bashrc
echo $PATH
           

查詢版本驗證:

xtensa-esp32-elf-gcc -v
           

環境添加成功:

Using built-in specs.
COLLECT_GCC=xtensa-esp32-elf-gcc
COLLECT_LTO_WRAPPER=/home/pjw/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../libexec/gcc/xtensa-esp32-elf/8.4.0/lto-wrapper
Target: xtensa-esp32-elf
Configured with: /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=xtensa-esp32-elf --prefix=/builds/idf/crosstool-NG/builds/xtensa-esp32-elf --with-local-prefix=/builds/idf/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf --with-headers=/builds/idf/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/include --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG esp-2020r3' --disable-__cxa_atexit --enable-cxx-flags=-ffunction-sections --disable-libgomp --disable-libmudflap --disable-libmpx --disable-libssp --disable-libquadmath --disable-libquadmath-support --with-gmp=/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-mpfr=/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-mpc=/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/buildtools --with-isl=/builds/idf/crosstool-NG/.build/xtensa-esp32-elf/buildtools --enable-lto --enable-target-optspace --without-long-double-128 --disable-nls --enable-multiarch --enable-languages=c,c++ --disable-libstdcxx-verbose --enable-threads=posix --enable-gcov-custom-rtio --enable-libstdcxx-time=yes
Thread model: posix
gcc version 8.4.0 (crosstool-NG esp-2020r3) 
           

再次執行

make menuconfig

成功:

Toolchain path: /home/pjw/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
Toolchain version: esp-2020r3
Compiler version: 8.4.0
Python requirements from /home/pjw/ESP32/esp-idf/requirements.txt are satisfied.
MENUCONFIG


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

Project is not inside a git repository, will not use 'git describe' to determine PROJECT_VER.
App "hello-world" version: 1