Wassim Benali
Wassim Benali

Reputation: 31

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.

Upvotes: 3

Views: 1666

Answers (1)

Nikolai Varankine
Nikolai Varankine

Reputation: 91

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.

Upvotes: 2

Related Questions