[solved] Cmake can't find compiler after running idf.py -C components create-component (IDF-2442)

RichPiano
Posts: 123
Joined: Mon May 18, 2020 2:51 pm

[solved] Cmake can't find compiler after running idf.py -C components create-component (IDF-2442)

Postby RichPiano » Fri Nov 27, 2020 5:25 pm

I have a project dir and I try to add a new component using the idf.py utility script:

idf.py -C components create-component my_component

as documented here: https://docs.espressif.com/projects/esp ... ystem.html

But it doesn't work, apparently there's no compiler found. But I have no idea what i should input into the PATH variable or if it's even required? I'm thinking I might have misconfigured something.

Here's the context:

Code: Select all

C:\dev\30_https_ota>idf.py -C components create-component my_component
Executing action: create-component
Running cmake in directory c:\dev\30_https_ota\components\build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 --warn-uninitialized -DCCACHE_ENABLE=1 c:\dev\30_https_ota\components"...
Warn about uninitialized values.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
  No CMAKE_C_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error in CMakeLists.txt:
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.13)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
See also "C:/dev/30_https_ota/components/build/CMakeFiles/CMakeOutput.log".
See also "C:/dev/30_https_ota/components/build/CMakeFiles/CMakeError.log".
cmake failed with exit code 1
Any ideas?

User avatar
ESP_Roland
Posts: 265
Joined: Tue Oct 09, 2018 10:28 am

Re: Cmake can't find compiler after running idf.py -C components create-component

Postby ESP_Roland » Sat Nov 28, 2020 10:31 am

Hi RichPiano,

are you able to build an IDF example project? Are you inside the ESP-IDF Command Prompt or have you run the export.bat for setting up the tools? Are you able to successfully run "xtensa-esp32-elf-gcc --version"?

RichPiano
Posts: 123
Joined: Mon May 18, 2020 2:51 pm

Re: Cmake can't find compiler after running idf.py -C components create-component

Postby RichPiano » Sat Nov 28, 2020 1:06 pm

Thank you for your answer Roland.

I'm running

Code: Select all

idf.py -C components create-component my_component
from inside a VS Code terminal (where I have set up export.bat to be executed at the start of the workspace) or from within a terminal where I run export.bat once to set up path. Both result in the same error. Note that running idf.py build & flash works as intended.

Running xtensa-esp32-elf-gcc --version works:

Code: Select all

C:\dev\30_https_ota>xtensa-esp32-elf-gcc --version
xtensa-esp32-elf-gcc (crosstool-NG esp-2020r2) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I have also successfully built and flashed template projects, however this is the first one I'm setting up myself, hence the add-component task ^^

User avatar
ESP_Roland
Posts: 265
Joined: Tue Oct 09, 2018 10:28 am

Re: Cmake can't find compiler after running idf.py -C components create-component

Postby ESP_Roland » Sat Nov 28, 2020 8:05 pm

Hi RichPiano,

I'm sorry that I cannot give you a straight answer how to solve this issue. The error message is very strange: "Running cmake in directory c:\dev\30_https_ota\components\build". It goes to the component directory and tries to build there. Are your "components" directory empty in the beginning?

I've run your command on Linux and Windows and the result for me was just two lines:

Code: Select all

Executing action: create-component
The component was created in /tmp/components/my_component
Could you please try to run "idf.py python-clean"? This usually helps for strange cases like this. Could you please post also the output of "idf.py --version" and "cmake --version"?

RichPiano
Posts: 123
Joined: Mon May 18, 2020 2:51 pm

Re: Cmake can't find compiler after running idf.py -C components create-component

Postby RichPiano » Mon Nov 30, 2020 9:57 am

No worries I'm thankful for your answer anyway. I also think it's a very strange bug since I can build a fully functional blink app from within VS Code and then flash it.

This is the output:

Code: Select all

C:\dev\30_https_ota>idf.py --version
ESP-IDF v4.1-dirty

C:\dev\30_https_ota>cmake --version
cmake version 3.13.4

CMake suite maintained and supported by Kitware (kitware.com/cmake).
running

Code: Select all

idf.py python-clean
didn't change the behaviour unfortunately.

Also I'm wondering why idf.py is kicking on cmake.. what is there to build? Or is cmake needed to create the appropriate files?

User avatar
ESP_Roland
Posts: 265
Joined: Tue Oct 09, 2018 10:28 am

Re: Cmake can't find compiler after running idf.py -C components create-component (IDF-2442)

Postby ESP_Roland » Mon Nov 30, 2020 10:28 am

Thank you RichPiano for the additional info and your patience with this. I've created a task for this and my colleague will get back to you.

martin.gano
Posts: 2
Joined: Fri Nov 27, 2020 10:41 pm

Re: Cmake can't find compiler after running idf.py -C components create-component (IDF-2442)

Postby martin.gano » Mon Nov 30, 2020 11:28 pm

Hi, RichPiano, thank you for providing information.

The command "create-component" is a relatively new one. It seems that you are using ESP-IDF version 4.1 that doesn't support the feature (see the documentation for your version https://docs.espressif.com/projects/esp ... ystem.html). I recommend you to clone the latest version of ESP-IDF (a master branch from GitHub https://github.com/espressif/esp-idf) that supports the command.

You can also create a component manually using the component template https://github.com/espressif/esp-idf/tr ... _component.

Thank you for your patience and if anything would be unclear feel free to ask.

RichPiano
Posts: 123
Joined: Mon May 18, 2020 2:51 pm

Re: Cmake can't find compiler after running idf.py -C components create-component (IDF-2442)

Postby RichPiano » Tue Dec 01, 2020 10:21 am

Thank you both very much!

Re-cloning the repo did it for me. I think it was using install.bat once more that fixed the problem in the end, as seemingly some python packages were out of date.

Can be closed

User avatar
ESP_Roland
Posts: 265
Joined: Tue Oct 09, 2018 10:28 am

Re: Cmake can't find compiler after running idf.py -C components create-component (IDF-2442)

Postby ESP_Roland » Tue Dec 01, 2020 11:30 am

Great! I'm happy that it got resolved.

voidzero
Posts: 6
Joined: Tue Jul 16, 2024 4:22 pm

Re: [solved] Cmake can't find compiler after running idf.py -C components create-component (IDF-2442)

Postby voidzero » Tue Jul 16, 2024 6:34 pm

I just ran the installer from https://dl.espressif.com/dl/idf-install ... e-2.27.exe

It is supposed to set up everything, but, I am now getting exactly the same issue as above. I'm a noob at this what should I do? I'm using Windows 11.

I also reported this here:

https://github.com/espressif/esp-idf/issues/7892

Who is online

Users browsing this forum: No registered users and 83 guests