Page 1 of 1

ESP-IDF VSCode Extension - CMake error

Posted: Fri May 21, 2021 8:35 pm
by martingcavallo
Hi everyone!

I am new with ESP-IDF. I am starting with VSCode and ESP-IDF Extension. I have watched severals tutorial but I still have problems to run the hello-world example.

First, I had the problem that the standard library <stdio.h> was not found. I found and read a lot of issues in this forum and github issues but the problem was solved alone after attempt a lot of time, installing, uninstalling, and changing the ESP-IDF Extension Version. What I could see was that when the problem occurred, the

Code: Select all

 "compilerPath"
in

Code: Select all

c_cpp_properties.json
file was empty, like

Code: Select all

 "compilerPath":""
. And when the problem was solved, "compilerPath" took the value of the path to the xtensa-esp32-elf-gcc.exe file.

Code: Select all

"compilerPath": "C:\\ESP\\tools\\.espressif\\tools\\xtensa-esp32-elf\\esp-2020r3-8.4.0\\xtensa-esp32-elf\\bin\\xtensa-esp32-elf-gcc.exe"
I do not know why at the beggining, this did not happen.

After that this problem was solved, I tried to build the project but got the follow error:

Code: Select all

> Executing task: cmake -G Ninja .. <

CMake Error: The current CMakeCache.txt directory D:/OneDrive/8 Desarrollo Software/5 ESP-IDF/hello_world/build/CMakeCache.txt is different than the directory c:/ESP/esp-idf/examples/get-started/hello_world/build where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
CMake Error: The source "D:/OneDrive/8 Desarrollo Software/5 ESP-IDF/hello_world/CMakeLists.txt" does not match the source "C:/ESP/esp-idf/examples/get-started/hello_world/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command cmake -G Ninja .." terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it
As you can see, ESP-IDF and ESP-IDF Tools are installed in "C:/", and the project created from example is saved in "D:/", that is a partition of the hard disk.

What is exactly what I have to do/modify???

I am using:
ESP-IDF V4.2
ESP-IDF VSCode Extension V1.0.3
Windows 10 Pro

Thanks in advance.

Re: ESP-IDF VSCode Extension - CMake error

Posted: Tue May 25, 2021 6:57 am
by ESP_bignacio
Please review https://github.com/espressif/vscode-esp ... URATION.md

Can you try to run the project in a folder without spaces? It seems to be a known issue when building projects.

Re: ESP-IDF VSCode Extension - CMake error

Posted: Thu Jun 17, 2021 1:52 am
by martingcavallo
Hi @ESP_bignacio! Thanks for your replay and sorry for my delayed response.

A few days later after I wrote this post I tried what you suggested and I could build the examples. I remember that I still had problem with one example but do not worry.

I am sorry that I did not test this before writing the post, because it is common problem in several different platforms or environment in general.

Thanks again.

Martin

Re: ESP-IDF VSCode Extension - CMake error

Posted: Thu Jun 17, 2021 8:57 pm
by orbitcoms
I have had no end of problems with the extension in vscode.
Almost every update breaks something else and the installer does not put into place all it needs to run.

There always seems to be issues with finding python and now since latest "update" I get cmake errors. Each time costs me several days in lost production so I decided not to use vscode or the extension any more. (Whish is a shame because when it does work it is a simple and reasonably fast ide). I love the esp32 hardware but the toolchain setup is cumbersome.

I switched to using Visual Studio and Visual GDB. It installed and ran immediately without any issues.