Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build an ESP project on VSCode when having ninja and CMake issues?

Executing task: cmake -G Ninja .. <

-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Users/ASUS/.espressif/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: C:/Users/ASUS/.espressif/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: C:/Users/ASUS/.espressif/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe -- 
broken
CMake Error at C:/Users/ASUS/Desktop/project/classmates/tools/cmake/3.16.4/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "C:/Users/ASUS/.espressif/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/ASUS/Desktop/project/esp-idf-master/build/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/Users/ASUS/anaconda4/Scripts/ninja.exe cmTC_4bc5c && [1/2] Building C object CMakeFiles/cmTC_4bc5c.dir/testCCompiler.c.obj        
    [2/2] Linking C executable cmTC_4bc5c.exe
    FAILED: cmTC_4bc5c.exe
    cmd.exe /C "cd . && C:\Users\ASUS\.espressif\.espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe    CMakeFiles/cmTC_4bc5c.dir/testCCompiler.c.obj  -o cmTC_4bc5c.exe -Wl,--out-implib,libcmTC_4bc5c.dll.a -Wl,--major-image-version,0,--minor-image-version,0   && cd ."   
    c:/users/asus/.espressif/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: unrecognized option '--major-image-version'
    c:/users/asus/.espressif/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: use the --help option for usage information
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


-- Configuring incomplete, errors occurred!
See also "C:/Users/ASUS/Desktop/project/esp-idf-master/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/ASUS/Desktop/project/esp-idf-master/build/CMakeFiles/CMakeError.log".
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.
like image 510
Wassim Benali Avatar asked Dec 06 '25 11:12

Wassim Benali


1 Answers

Try to remove "build" folder in project's folder and repeat the build. Removed folder will be re-created by CMake. This error othen happens when some project has been copied to new location and attempted to build.

like image 55
Nikolai Varankine Avatar answered Dec 09 '25 16:12

Nikolai Varankine



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!