【问题解决】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 xtensa-esp32-elf@esp-2020r3-8.4.0
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 esp32ulp-elf@2.28.51.20170517
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 openocd-esp32@v0.10.0-esp32-20200709
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 环境,没有找到:

echo $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
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值