espressif / ESP8266_RTOS_SDK

Latest ESP8266 SDK based on FreeRTOS, esp-idf style.
http://bbs.espressif.com
Apache License 2.0
3.34k stars 1.57k forks source link

make: xtensa-lx106-elf-gcc: Command not found (GIT8266O-349) #785

Open GarMingLi opened 4 years ago

GarMingLi commented 4 years ago

Environment

Problem Description

I built the development environment of ESP8266 RTOS SDK in the Ubuntu subsystem of win10, but there was an error when compiling:

make: xtensa-lx106-elf-gcc: Command not found
expr: syntax error
/bin/sh: 1: xtensa-lx106-elf-gcc: not found
/bin/sh: 1: xtensa-lx106-elf-gcc: not found
Toolchain path: 
WARNING: Failed to find Xtensa toolchain, may need to alter PATH or set one in the configuration menu
Python requirements from /home/ljm/esp/ESP8266_RTOS_SDK/requirements.txt are satisfied.
make[1]: xtensa-lx106-elf-gcc: Command not found
expr: syntax error
/bin/sh: 1: xtensa-lx106-elf-gcc: not found
/bin/sh: 1: xtensa-lx106-elf-gcc: not found
WARNING: Failed to find Xtensa toolchain, may need to alter PATH or set one in the configuration menu
CC build/bootloader/main/bootloader_start.o
make[2]: xtensa-lx106-elf-gcc: Command not found
/home/ljm/esp/ESP8266_RTOS_SDK/make/component_wrapper.mk:291: recipe for target 'bootloader_start.o' failed
make[2]: *** [bootloader_start.o] Error 127
/home/ljm/esp/ESP8266_RTOS_SDK/make/project.mk:571: recipe for target 'component-main-build' failed
make[1]: *** [component-main-build] Error 2

echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:~/esp/xtensa-lx106-elf/bin

xtensa-lx106-elf-gcc -v

Using built-in specs.
COLLECT_GCC=/home/ljm/esp/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc
COLLECT_LTO_WRAPPER=/home/ljm/esp/xtensa-lx106-elf/bin/../libexec/gcc/xtensa-lx106-elf/5.2.0/lto-wrapper
Target: xtensa-lx106-elf
Configured with: /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=xtensa-lx106-elf --prefix=/builds/idf/crosstool-NG/builds/xtensa-lx106-elf --with-local-prefix=/builds/idf/crosstool-NG/builds/xtensa-lx106-elf/xtensa-lx106-elf/sysroot --with-sysroot=/builds/idf/crosstool-NG/builds/xtensa-lx106-elf/xtensa-lx106-elf/sysroot --with-newlib --enable-threads=no --disable-shared --with-pkgversion='crosstool-NG crosstool-ng-1.22.0-100-ge567ec7' --disable-__cxa_atexit --enable-cxx-flags='-fno-exceptions -fno-rtti' --with-gmp=/builds/idf/crosstool-NG/.build/xtensa-lx106-elf/buildtools --with-mpfr=/builds/idf/crosstool-NG/.build/xtensa-lx106-elf/buildtools --with-mpc=/builds/idf/crosstool-NG/.build/xtensa-lx106-elf/buildtools --with-isl=/builds/idf/crosstool-NG/.build/xtensa-lx106-elf/buildtools --with-cloog=/builds/idf/crosstool-NG/.build/xtensa-lx106-elf/buildtools --with-libelf=/builds/idf/crosstool-NG/.build/xtensa-lx106-elf/buildtools --enable-lto --enable-target-optspace --without-long-double-128 --disable-libgomp --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libquadmath-support --disable-nls --disable-multilib --enable-languages=c,c++
Thread model: single
gcc version 5.2.0 (crosstool-NG crosstool-ng-1.22.0-100-ge567ec7) 

The environment variable is normal, but I'm not sure why it was compiled incorrectly.

JackieLi1011 commented 4 years ago

Typesource ~/.profile in your terminal to execute your environment variable

GarMingLi commented 4 years ago

I would have done this earlier, otherwise the print path wouldn't have seen the message.

GarMingLi commented 4 years ago

But now that I've switched to root, I'm ready to compile.

donghengqaz commented 4 years ago

It is amazing, I see the toolchain is xtensa-lx106-elf-linux32-1.22.0-100-ge567ec7-5.2.0.tar, and it is used at 32-bit ubuntu system, so do you ubuntu WSL is 32-bit ?

GarMingLi commented 4 years ago

64-bit.

Splines commented 3 years ago

@GarMingLi Did you manage to get this to work? I'm not using WSL(2) since there is no USB passthrough yet, thus I can't flash to my ESP8266 board.

I'm now trying MSYS2 and downloaded the "all-in-one toolchain & MSYS2 zip file" from here. Then, I also downloaded the toolchain for ESP8266 from the same site and put it in my ~/esp folder. I've updated the PATH (in .bash_profile) to include xtensa-lx106-elf/bin, however when running make the command can't be found.

I get the same error message that the command can't be found and additionally:

$ make
make: xtensa-lx106-elf-gcc: Command not found
expr: syntax error: unexpected argument „5.2.0“
which: no xtensa-lx106-elf-gcc in (hereIsMyPathWhereTheBinsAreLocated)
...
Splines commented 3 years ago

I've just moved the xtensa-lx106-elf-gcc folder to /opt (where you can already see the folder xtensa-esp32-elf. Then, I've added these two lines at the end of .bash_profile:

_Note that C:/msys32/home/domin/esp/ESP8266_RTOS_SDK is the path I've cloned the RTOSSDK into.

export PATH=$PATH:/opt/xtensa-lx106-elf/bin
export IDF_PATH="C:/msys32/home/domin/esp/ESP8266_RTOS_SDK"

I don't know why, but now it's working 🎉 The fact, that we should put the extracted xtensa toolchain (in my case for Windows 10 using MSYS2) into the /opt folder, should definitely be added to the documentation here.

nabeelkirmani commented 3 years ago

Navigate to any of the examples and run make. Hopefully, it should all work now.

Rami1986 commented 1 year ago
  • [ ] I solved this by extracting the xtensa-lx106-elf-gcc8_4_0-esp-2020r3-win32.zip file into msys32 home directory so now my Xtensa path looks like this: C:\msys32\home\PC\xtensa-lx106-elf\bin (where instead of PC it will be your username)
  • [ ] Once this is done, open mingw32.exe and run the following commands: PATH="${HOME}/xtensa-lx106-elf/bin:${PATH}" export IDF_PATH=~/esp/ESP8266_RTOS_SDK
  • [ ] Now run echo $PATH and echo $IDF_PATH to check if the newly included paths are there.

Navigate to any of the examples and run make. Hopefully, it should all work now.

this works for me, thanks @nabeelkirmani

GiaMat90 commented 10 months ago

I solved this by extracting the xtensa-lx106-elf-gcc8_4_0-esp-2020r3-win32.zip file into msys32 home directory so now my Xtensa path looks like this: C:\msys32\home\PC\xtensa-lx106-elf\bin (where instead of PC it will be your username)

Once this is done, open mingw32.exe and run the following commands: PATH="${HOME}/xtensa-lx106-elf/bin:${PATH}" export IDF_PATH=~/esp/ESP8266_RTOS_SDK

Now run echo $PATH and echo $IDF_PATH to check if the newly included paths are there.

This works for me too. I agree with @nabeelkirmani, the guide should be improved.