CMake error while building

- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- The ASM compiler identification is GNU
-- Found assembler: /home/maxwell/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /home/maxwell/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /home/maxwell/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc -- broken
-- Configuring incomplete, errors occurred!
See also "/home/maxwell/Documents/PlatformIO/Projects/TimerDevice/.pio/build/esp32dev/CMakeFiles/CMakeOutput.log".
See also "/home/maxwell/Documents/PlatformIO/Projects/TimerDevice/.pio/build/esp32dev/CMakeFiles/CMakeError.log".

fatal: not a git repository (or any of the parent directories): .git
CMake Error at /home/maxwell/.platformio/packages/tool-cmake/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "/home/maxwell/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/maxwell/Documents/PlatformIO/Projects/TimerDevice/.pio/build/esp32dev/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/home/maxwell/.platformio/packages/tool-ninja/ninja cmTC_135d3 && [1/2] Building C object CMakeFiles/cmTC_135d3.dir/testCCompiler.c.obj
    FAILED: CMakeFiles/cmTC_135d3.dir/testCCompiler.c.obj 
    /home/maxwell/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc   -mlongcalls -Wno-frame-address -o CMakeFiles/cmTC_135d3.dir/testCCompiler.c.obj   -c testCCompiler.c
    as: unrecognized option '--longcalls'
    ninja: build stopped: subcommand failed.
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  /home/maxwell/.platformio/packages/framework-espidf/tools/cmake/project.cmake:269 (__project)
  CMakeLists.txt:3 (project)


CMake Error at /home/maxwell/.platformio/packages/framework-espidf/tools/cmake/project.cmake:269 (__project):
  The CMAKE_CXX_COMPILER:

    xtensa-esp32-elf-g++

  is not a full path and was not found in the PATH.

  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.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)

This project was building before I mistakenly deleted the .pio folder. Now when I try to build it I get the above error. I am not sure what do. I tried reinstall pio and reinstalling the espressif platform but I still keep getting this error. This is my platform.ini file:

[env:esp32dev]

platform = espressif32

framework =

arduino

espidf

board = esp32dev

build_flags =

-D ESP32

board_build.partitions = partition.csv

build_unflags =

-Werror=all

-fno-exceptions

monitor_speed = 115200

platform_packages = framework-arduinoespressif32 @ GitHub - espressif/arduino-esp32: Arduino core for the ESP32

lib_compat_mode = strict

lib_deps =

GitHub - me-no-dev/AsyncTCP: Async TCP Library for ESP32

SHA-1 Hash

GitHub - Makuna/Rtc: Arduino Library for RTCs, Ds1302, Ds1307, Ds3231, Ds3232, Ds3234 and Pcf8563/BM8563 with deep support. Please refer to the Wiki for more details. Please use the Github Discussions to ask questions as the GitHub Issues feature is used for bug tracking.

GitHub - me-no-dev/ESPAsyncWebServer: Async Web Server for ESP8266 and ESP32

GitHub - bblanchon/ArduinoJson: đź“ź JSON library for Arduino and embedded C++. Simple and efficient.

extra_scripts = gzip_data.py

debug_tool = esp-prog

debug_init_break = tbreak setup

[platformio]

description = The Final Module For ESP32 Timer Device

Does it have the CMakeLists.txt you expect for your ESP-IDF project? Does it build using pio run?

You might be running in an error already discussed in the forums (Newly generated espidf project doesn't build in CLion - #15 by valeros), that using ESP-IDF, which is CMake based, does not play well with CLion which is also CMake based. The CMakeLists.txt of the project needed for ESP-IDF is overwritten by PIO when it reinits the project for CLion.

1 Like

I am assuming you are referring to the CMakeLists.txt in the main folder. This is the content:

cmake_minimum_required(VERSION 3.16.0)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(TimerDevice)

It was building until I mistakenly deleted the .pio folder :confused: I may have updated espressif to the wrong version also.

Anyway, I tried setting the platform to platform = espressif32@1.11.2. Now I am getting a different set of errors(which I didn’t get earlier). Not sure how it worked before. I guess its best to note down all the version numbers being used when everything works.

Yeah that looks good for a correct build. CLion will of course fail with this CMakeLists.txt.

Have you tried a manual pio run with no change in platform? Setting 1.11.2 will also give you an older ESP-IDF version, so that usually breaks code.

1 Like

Actually I am using vscode not CLion. Is the error on VScode also?

The manual pio run didn’t work. I am getting a different error now:

Traceback (most recent call last):
  File "/home/maxwell/.platformio/packages/tool-scons/script/scons", line 104, in <module>
    import pkg_resources
  File "/home/maxwell/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 24, in <module>
    import re
  File "/usr/lib/python3.6/re.py", line 142, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 62, in apport_excepthook
    if not enabled():
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 24, in enabled
    import re
  File "/usr/lib/python3.6/re.py", line 142, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

Original exception was:
Traceback (most recent call last):
  File "/home/maxwell/.platformio/packages/tool-scons/script/scons", line 104, in <module>
    import pkg_resources
  File "/home/maxwell/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 24, in <module>
    import re
  File "/usr/lib/python3.6/re.py", line 142, in <module>
    class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

VSCode should suffer no such issues, much less a pure pio run.

Check solution according to this: Why Python 3.6.1 throws AttributeError: module 'enum' has no attribute 'IntFlag'? - Stack Overflow

Did you recently change your python installation, or installed something like Anaconda?

I did not change any python settings. I uninstall enum34 as that link mentioned and it solved that error but it still did not solve the error that I mentioned in the first post:

-- The C compiler identification is unknown

– The CXX compiler identification is unknown
– The ASM compiler identification is GNU
– Found assembler: /home/maxwell/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc
– Check for working C compiler: /home/maxwell/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc
– Check for working C compiler: /home/maxwell/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc – broken
– Configuring incomplete, errors occurred!
See also “/home/maxwell/Documents/PlatformIO/Projects/TimerDevice/.pio/build/esp32dev/CMakeFiles/CMakeOutput.log”.
See also “/home/maxwell/Documents/PlatformIO/Projects/TimerDevice/.pio/build/esp32dev/CMakeFiles/CMakeError.log”.

fatal: not a git repository (or any of the parent directories): .git
CMake Error at /home/maxwell/.platformio/packages/tool-cmake/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

"/home/maxwell/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /home/maxwell/Documents/PlatformIO/Projects/TimerDevice/.pio/build/esp32dev/CMakeFiles/CMakeTmp

Run Build Command(s):/home/maxwell/.platformio/packages/tool-ninja/ninja cmTC_5268c && [1/2] Building C object CMakeFiles/cmTC_5268c.dir/testCCompiler.c.obj
FAILED: CMakeFiles/cmTC_5268c.dir/testCCompiler.c.obj 
/home/maxwell/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc   -mlongcalls -Wno-frame-address -o CMakeFiles/cmTC_5268c.dir/testCCompiler.c.obj   -c testCCompiler.c
as: unrecognized option '--longcalls'
ninja: build stopped: subcommand failed.

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
/home/maxwell/.platformio/packages/framework-espidf/tools/cmake/project.cmake:269 (__project)
CMakeLists.txt:3 (project)

CMake Error at /home/maxwell/.platformio/packages/framework-espidf/tools/cmake/project.cmake:269 (__project):
The CMAKE_CXX_COMPILER:

xtensa-esp32-elf-g++

is not a full path and was not found in the PATH.

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.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)

This error occurs both when I run pio run on the terminal and when I click build in platformio when I set the platform to espressif32@1.12.4

Edit: Made the errors that appear in red in the terminal output bold

I only remember seeing this problem when CMake is invoked by CLion, but not on its own, hm.

Try and make a sanity check first for a platform-provided example. Get everything up-to-date

pio upgrade --dev
pio platform update

Then navigate to your .platformio folder in the home folder and locate the espidf-arduio-blink example ni platform/espressif32 for the most recent version and compile it. For me thats

C:\Users\Maxi\.platformio\platforms\espressif32\examples\espidf-arduino-blink>pio run -e esp32dev
Processing esp32dev (platform: espressif32; framework: arduino, espidf; board: esp32dev)
------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (1.12.4) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 0.0.0+sha.475208e
 - framework-espidf 3.40001.200521 (4.0.1)
 - tool-cmake 3.16.4
 - tool-esptoolpy 1.20600.0 (2.6.0)
 - tool-idf 1.0.1
 - tool-mconf 1.4060000.20190628 (406.0.0)
 - tool-ninja 1.9.0
 - toolchain-esp32ulp 1.22851.191205 (2.28.51)
 - toolchain-xtensa32 2.80200.200827 (8.2.0)
[...]
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.0% (used 13076 bytes from 327680 bytes)
Flash: [==        ]  17.2% (used 180133 bytes from 1048576 bytes)
============================================ [SUCCESS] Took 807.47 seconds ============================================

Environment    Status    Duration
-------------  --------  ------------
esp32dev       SUCCESS   00:13:27.466

If that’s failing too, remove the package folder from your .platformio\packages\ installation and retry.

Hi @mntolia! Looks like corrupted toolchain to me, try to delete folder /home/maxwell/.platformio/packages/toolchain-xtensa32 and run your project again.

1 Like

Yes that was the issue.

Thanks valeros & maxgerhardt.

Hi there,
I am getting exactly those same errors as @mntolia had. I am also using vscode on wsl ubuntu. I would appreciate any help I can get.