espressif / vscode-esp-idf-extension

Visual Studio Code extension for ESP-IDF projects
https://docs.espressif.com/projects/vscode-esp-idf-extension/en/latest/
Apache License 2.0
1.08k stars 307 forks source link

crosstool-ng version error after re-installing ESP-IDF with the vs-code extension (VSC-1025) #862

Closed tongclement closed 1 year ago

tongclement commented 1 year ago

OS

MacOS

Operating System version

M1 Mac OS 12.6

Visual Studio Code version

1.74.2 (Universal)

ESP-IDF version

4.4.3

Python version

3.10

Doctor command output

---------------------------------------------- ESP-IDF Extension for Visual Studio Code report ---------------------------------------------
OS darwin arm64 21.6.0 
System environment variable IDF_PYTHON_ENV_PATH 
 undefined 
System environment variable PATH 
 <HOMEPATH>/.deta/bin:/usr/local/sbin:<HOMEPATH>/miniforge3/bin:<HOMEPATH>/miniforge3/condabin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:<HOMEPATH>/Developer/flutter/bin 
System environment variable PYTHON 
 undefined 
Visual Studio Code version 1.74.2 
Visual Studio Code language en 
Visual Studio Code shell /bin/zsh 
ESP-IDF Extension version 1.5.1 
Workspace folder <HOMEPATH>/Desktop/Programming/2022/safelybuoy/experimentation/ardunio-as-a-component/ardunio-as-a-component-example 
---------------------------------------------------- Extension configuration settings ------------------------------------------------------
ESP-ADF Path (idf.espAdfPath) <HOMEPATH>/.espressif/esp-adf
ESP-IDF Path (idf.espIdfPath) <HOMEPATH>/esp/esp-idf
ESP-MDF Path (idf.espMdfPath) ${env:MDF_PATH}
ESP-Matter Path (idf.espMatterPath) ${env:ESP_MATTER_PATH}
Custom extra paths (idf.customExtraPaths) <HOMEPATH>/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin:<HOMEPATH>/.espressif/tools/xtensa-esp32s2-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s2-elf/bin:<HOMEPATH>/.espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s3-elf/bin:<HOMEPATH>/.espressif/tools/riscv32-esp-elf/esp-2021r2-patch3-8.4.0/riscv32-esp-elf/bin:<HOMEPATH>/.espressif/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin:<HOMEPATH>/.espressif/tools/esp32s2ulp-elf/2.28.51-esp-20191205/esp32s2ulp-elf-binutils/bin:<HOMEPATH>/.espressif/tools/openocd-esp32/v0.11.0-esp32-20211220/openocd-esp32/bin
Custom extra vars (idf.customExtraVars) {"OPENOCD_SCRIPTS":"<HOMEPATH>/.espressif/tools/openocd-esp32/v0.11.0-esp32-20211220/openocd-esp32/share/openocd/scripts"}
Virtual env Python Path (idf.pythonBinPath) <HOMEPATH>/.espressif/python_env/idf4.3_py3.9_env/bin/python
Serial port (idf.port) /dev/cu.SLAB_USBtoUART
OpenOCD Configs (idf.openOcdConfigs) board/esp32-wrover-kit-3.3v.cfg
ESP-IDF Tools Path (idf.toolsPath) <HOMEPATH>/.espressif
Git Path (idf.gitPath) git
-------------------------------------------------------- Configurations access -------------------------------------------------------------
Access to ESP-ADF Path (idf.espAdfPath) true
Access to ESP-IDF Path (idf.espIdfPath) true
Access to ESP-MDF Path (idf.espMdfPath) false
Access to ESP-Matter Path (idf.espMatterPath) false
Access to ESP-IDF Custom extra paths
Access to <HOMEPATH>/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin: true
Access to <HOMEPATH>/.espressif/tools/xtensa-esp32s2-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s2-elf/bin: true
Access to <HOMEPATH>/.espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s3-elf/bin: true
Access to <HOMEPATH>/.espressif/tools/riscv32-esp-elf/esp-2021r2-patch3-8.4.0/riscv32-esp-elf/bin: true
Access to <HOMEPATH>/.espressif/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin: true
Access to <HOMEPATH>/.espressif/tools/esp32s2ulp-elf/2.28.51-esp-20191205/esp32s2ulp-elf-binutils/bin: true
Access to <HOMEPATH>/.espressif/tools/openocd-esp32/v0.11.0-esp32-20211220/openocd-esp32/bin: true
Access to Virtual env Python Path (idf.pythonBinPath) true
Access to CMake in environment PATH true
Access to Ninja in environment PATH true
Access to ESP-IDF Tools Path (idf.toolsPath) true
-------------------------------------------------------- Configurations has spaces -------------------------------------------------------------
Spaces in system environment Path false
Spaces in ESP-ADF Path (idf.espAdfPath) false
Spaces in ESP-IDF Path (idf.espIdfPath) false
Spaces in ESP-MDF Path (idf.espMdfPath) false
Spaces in ESP-Matter Path (idf.espMatterPath) false
Spaces in ESP-IDF Custom extra paths
Spaces in <HOMEPATH>/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin: false
Spaces in <HOMEPATH>/.espressif/tools/xtensa-esp32s2-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s2-elf/bin: false
Spaces in <HOMEPATH>/.espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32s3-elf/bin: false
Spaces in <HOMEPATH>/.espressif/tools/riscv32-esp-elf/esp-2021r2-patch3-8.4.0/riscv32-esp-elf/bin: false
Spaces in <HOMEPATH>/.espressif/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin: false
Spaces in <HOMEPATH>/.espressif/tools/esp32s2ulp-elf/2.28.51-esp-20191205/esp32s2ulp-elf-binutils/bin: false
Spaces in <HOMEPATH>/.espressif/tools/openocd-esp32/v0.11.0-esp32-20211220/openocd-esp32/bin: false
Spaces in Virtual env Python Path (idf.pythonBinPath) false
Spaces in ESP-IDF Tools Path (idf.toolsPath) false
----------------------------------------------------------- Executables Versions -----------------------------------------------------------
Git version 2.23.0
ESP-IDF version 4.4.3
Python version 3.9.12
Python's pip version 22.2.2
-------------------------------------------------- Python packages in idf.pythonBinPath ----------------------------------------------------
bitstring version: 3.1.9
Brotli version: 1.0.9
certifi version: 2022.6.15
cffi version: 1.15.1
charset-normalizer version: 2.1.0
click version: 8.1.3
colorama version: 0.4.5
construct version: 2.10.54
contextlib2 version: 21.6.0
cryptography version: 3.4.8
ecdsa version: 0.18.0
Flask version: 0.12.5
Flask-Compress version: 1.12
Flask-SocketIO version: 2.9.6
future version: 0.18.2
gcovr version: 5.1
gdbgui version: 0.13.2.0
gevent version: 1.5.0
greenlet version: 1.1.2
idf-component-manager version: 1.1.4
idna version: 3.3
itsdangerous version: 2.0.1
Jinja2 version: 3.0.3
kconfiglib version: 13.7.1
lxml version: 4.9.1
MarkupSafe version: 2.1.1
pip version: 22.2.2
psutil version: 5.9.1
pycparser version: 2.21
pyelftools version: 0.28
pygdbmi version: 0.9.0.2
Pygments version: 2.12.0
pyparsing version: 2.3.1
pyserial version: 3.5
python-engineio version: 3.14.2
python-socketio version: 4.6.1
PyYAML version: 6.0
reedsolo version: 1.5.4
requests version: 2.28.1
requests-toolbelt version: 0.9.1
schema version: 0.7.5
setuptools version: 63.4.1
six version: 1.16.0
tqdm version: 4.64.0
urllib3 version: 1.26.11
websocket-client version: 1.3.3
Werkzeug version: 0.16.1
wheel version: 0.37.1
xmlrunner version: 1.7.7
---------------------------------------------------- Check ESP-IDF python requirements.txt -------------------------------------------------
Check ESP-IDF Python packages Python requirements from <HOMEPATH>/esp/esp-idf/requirements.txt are satisfied.
---------------------------------------------------- Check extension requirements.txt ------------------------------------------------------
Check Extension Python packages Python requirements from <HOMEPATH>/.vscode/extensions/espressif.esp-idf-extension-1.5.1/requirements.txt are satisfied.
---------------------------------------------------- Check ESP-IDF debug adapter requirements.txt ------------------------------------------
Check Debug AdapterPython packages Python requirements from <HOMEPATH>/.vscode/extensions/espressif.esp-idf-extension-1.5.1/esp_debug_adapter/requirements.txt are satisfied.
---------------------------------------------------- Visual Studio Code launch.json --------------------------------------------------------
{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "espidf",
      "name": "Launch",
      "request": "launch"
    }
  ]
} 
---------------------------------------------------- Visual Studio Code c_cpp_properties.json ----------------------------------------------
{
    "configurations": [
        {
            "name": "ESP-IDF",
            "compilerPath": "<HOMEPATH>/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "includePath": [
                "${config:idf.espIdfPath}/components/**",
                "${config:idf.espIdfPathWin}/components/**",
                "${config:idf.espAdfPath}/components/**",
                "${config:idf.espAdfPathWin}/components/**",
                "${workspaceFolder}/**"
            ],
            "browse": {
                "path": [
                    "${config:idf.espIdfPath}/components",
                    "${config:idf.espIdfPathWin}/components",
                    "${config:idf.espAdfPath}/components/**",
                    "${config:idf.espAdfPathWin}/components/**",
                    "${workspaceFolder}"
                ],
                "limitSymbolsToIncludedHeaders": false
            },
            "configurationProvider": "ms-vscode.makefile-tools"
        }
    ],
    "version": 4
} 
--------------------------------------------------------------------------------------------------------------------------------------------

Extension

no such file or directory

Description

I was trying to upgrade from esp-idf v4.3 to v4.4. I removed the esp-idf directory at the dir .../username/esp before using express setup inside the vs-code extension to install esp-idf.

Everything ran smoothly but when attempting to build the first project, I ran into a problem with crosstools-ng. It seems like the device has the wrong version.

Toolchain:
  /Users/[username]/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc,
  crosstool-ng version esp-2021r2-patch3 doesn't match supported version
  esp-2021r2-patch5

  Please try to run 'idf.py fullclean' to solve it quickly.

  Check Getting Started documentation if the error continues.

  You can override this error and proceed with build by defining the
  IDF_MAINTAINER environment variable.

What I attempted: I attempted installing different versions of the idf, rebooting the computer, restarting vs code, running the idf.py fullclean command, and more.

Debug Message

Either this appears:

Toolchain:
  /Users/[username]/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc,
  crosstool-ng version esp-2021r2-patch3 doesn't match supported version
  esp-2021r2-patch5

  Please try to run 'idf.py fullclean' to solve it quickly.

  Check Getting Started documentation if the error continues.

  You can override this error and proceed with build by defining the
  IDF_MAINTAINER environment variable.

OR:

ninja: error: loading 'build.ninja': No such file or directory

 *  The terminal process "/bin/zsh '-c', 'ninja '" failed to launch (exit code: 1). 


### Other Steps to Reproduce

_No response_

### I have checked existing issues, online documentation and the Troubleshooting Guide

- [X] I confirm I have checked existing issues, online documentation and Troubleshooting guide.
dobairoland commented 1 year ago

Notes at https://github.com/espressif/esp-idf/issues/10473 could provide more information on this issue. Let me know if any help is needed from the ESP-IDF side.

brianignacio5 commented 1 year ago

It might be related to some cache in the build directory. Try deleting the build folder and build again.

brianignacio5 commented 1 year ago

Any updates @tongclement ?

tongclement commented 1 year ago

@brianignacio5 thanks for asking. It had something to with the VSCode compiler path not updating when manually updating the ESP-IDF

https://github.com/espressif/esp-idf/issues/10473#issuecomment-1369108254

https://github.com/espressif/esp-idf/issues/10473#issuecomment-1369111267

Previous Recommendations pointed out on the other linked issue: 1: If this VS Code compiler path variable didn't change automatically as it is supposed to after an re-installation/update, please see if it can be fixed - or if it is my fault please let me know/put it in the docs about updating idf versions 2: The update process can be much easier than this so everyone can use the latest version without too much hassle and you guys don't have to deal with debugging and answering questions about older versions as much. For example: a one click "uninstaller" or an update command in the ESP-IDF command line

Many thanks!

tongclement commented 1 year ago

root cause of the vs code compiler path var not changing to be investigated, and esp idf update workflow to be improved

tongclement commented 1 year ago

It might be related to some cache in the build directory. Try deleting the build folder and build again.

I did do full cleans - it had no effect.

tongclement commented 1 year ago

Thanks to @dobairoland for his help, he previously replied that: https://github.com/espressif/esp-idf/issues/10473#issuecomment-1369738344 "Thanks @tongclement for your notes on this issue. I don't think that anything could be done on the ESP-IDF side. Perhaps in the linked vscode issue the developers will be able to improve this.

ESP-IDF does not change the PATH permanently. Changes to environment variables are discarded after the terminal is closed. PATH is updated by adding items to the beginning, therefore, globally set values are not affecting it. However, we cannot handle VScode-related workspace changes at this level. I'm closing this for this reason."

So maybe the can be changed from a bug report to a feature request/usability improvement: adding a one click idf updater/version changer/uninstaller. This might be seen as unnecessary for professionals who are very used to updating and downgrading but in my humble opinion it is a hindrance to using esp-idf (instead of the ardunio lib built on esp idf etc). However I do understand that an update/downgrader does require a lot of development so a one click full uninstaller might be easier. However, I do understand that the env variables, especially the OS level ones can't be changed by IDF - I guess it will be a challenge to setup IDF in the foreseeable future.

tongclement commented 1 year ago

Thanks for all the help and apologies for the mediocre documentation on my end.

brianignacio5 commented 1 year ago

Thanks for the information @tongclement .

The issue I notice is that while you are using ESP-IDF v4.4 in the extension, the tools listed in your settings are those from the previous v4.3 which is why when ESP-IDF is trying to build is not using the expected xtensa toolchain. Did you used the extension setup wizard to install the new version? Maybe you have settings defined in your project's .vscode/settings.json overwriting the global settings of vscode ?

brianignacio5 commented 1 year ago

Closing this issue for lack of update from the user. Please comment here if you have any additional issues.