Page 1 of 1

CMakeLists.txt error on project.cmake

Posted: Sun Aug 02, 2020 11:29 am
by kyrpav
Hello,
I am new to esp32 and i am trying on a debian system to work with vscode. I have installed the esp plugin , i did the config (everything looked fine).

I have selected the blink example to build and flash.

On the CMakeLists.txt i get this error :
include could not find load file:
home/platonas/Programs/esp/esp-idf/tools/cmake/project.cmakeCMake (include)
My CMakeLists.txt file is :

Code: Select all

[# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(blink)

When i try to build i get this output:
-- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32
-- Checking Python dependencies...
Python requirements from /home/platonas/Programs/esp/esp-idf/requirements.txt are satisfied.
Loading defaults file /home/platonas/Workspaces/vscode/blink/sdkconfig.defaults...
CMake Error at /home/platonas/Programs/esp/esp-idf/components/esp32/project_include.cmake:21 (message):
Internal error, toolchain has not been set correctly by project (or an
invalid CMakeCache.txt file has been generated somehow)
Call Stack (most recent call first):
/home/platonas/Programs/esp/esp-idf/tools/cmake/build.cmake:306 (include)
/home/platonas/Programs/esp/esp-idf/tools/cmake/build.cmake:451 (__build_process_project_includes)
/home/platonas/Programs/esp/esp-idf/tools/cmake/project.cmake:395 (idf_build_process)
CMakeLists.txt:6 (project)


-- Configuring incomplete, errors occurred!
See also "/home/platonas/Workspaces/vscode/blink/build/CMakeFiles/CMakeOutput.log".
The terminal process "/bin/sh '-c', 'cmake -G Ninja ..'" terminated with exit code: 1.
When i run cmake clean rebuild i get
[main] Building folder: blink clean
[main] Configuring folder: blink
[proc] Executing command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/home/platonas/.espressif/tools/xtensa-esp32-elf/esp-2020r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc-8.2.0 -H/home/platonas/Workspaces/vscode/blink -B/home/platonas/Workspaces/vscode/blink/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error at CMakeLists.txt:5 (include):
[cmake] include could not find load file:
[cmake]
[cmake] home/platonas/Programs/esp/esp-idf/tools/cmake/project.cmake
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "/home/platonas/Workspaces/vscode/blink/build/CMakeFiles/CMakeOutput.log".
My c_cpp_properties.json file is like:

Code: Select all

{
  "configurations": [
    {
      "name": "Linux",
      "cStandard": "c11",
      "cppStandard": "c++17",
      "configurationProvider": "vector-of-bool.cmake-tools",
      "includePath": [
        "${config:idf.espIdfPath}/components/**",
        "${config:idf.espIdfPathWin}/components/**",
        "${workspaceFolder}/**/*"
      ],
      "browse": {
        "path": [
          "${config:idf.espIdfPath}/components",
          "${config:idf.espIdfPathWin}/components",
          "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": false
      },
      "compileCommands": "${workspaceFolder}/build/compile_commands.json"
    }
  ],
  "version": 4
}
And my main settings.json file is:

Code: Select all

{
    // esp32 settings
    "idf.espIdfPath": "/home/platonas/Programs/esp/esp-idf",
    "idf.toolsPath": "/home/platonas/.espressif",
    "idf.customExtraPaths": "/home/platonas/.espressif/python_env/idf4.2_py3.8_env/bin:/usr/bin:/home/platonas/.espressif/tools/xtensa-esp32-elf/esp-2020r2-8.2.0/xtensa-esp32-elf/bin:/home/platonas/.espressif/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin:/home/platonas/.espressif/tools/openocd-esp32/v0.10.0-esp32-20200420/openocd-esp32/bin:/home/platonas/.espressif/tools/xtensa-esp32s2-elf/esp-2020r2-8.2.0/xtensa-esp32s2-elf/bin:/home/platonas/.espressif/tools/esp32s2ulp-elf/2.28.51-esp-20191205/esp32s2ulp-elf-binutils/bin",
    "idf.customExtraVars": "{\"OPENOCD_SCRIPTS\":\"/home/platonas/.espressif/tools/openocd-esp32/v0.10.0-esp32-20200420/openocd-esp32/share/openocd/scripts\"}",
    "idf.showOnboardingOnInit": false,
    "idf.pythonBinPath": "/home/platonas/.espressif/python_env/idf4.2_py3.8_env/bin/python",
    "idf.port": "/dev/ttyUSB0",
    "idf.openOcdConfigs": [
        "interface/ftdi/esp32_devkitj_v1.cfg",
        "board/esp32-wrover.cfg"
    ],

    // arduino settings
    "cmake.configureOnOpen": false,
    "terminal.integrated.shell.linux": "/bin/sh",
    "arduino.path": "/home/platonas/Programs/arduino-1.8.13",
    "arduino.commandPath": "arduino",
    "arduino.allowPDEFiletype": false, 
    "arduino.enableUSBDetection": true,
    "arduino.disableTestingOpen": false,
    "arduino.skipHeaderProvider": false,
    "arduino.defaultBaudRate": 115200
}

What do i miss?

Re: CMakeLists.txt error on project.cmake

Posted: Fri Aug 07, 2020 3:49 am
by ESP_bignacio
Try deleting the build folder on your project and try again. Settings seem to be ok.

Have you try build from the terminal and see what happens? Doesn't seem to be an issue with the extension itself.

IS there any error in the log:
- Windows: `%USERPROFILE%\.vscode\extensions\espressif.esp-idf-extension-VERSION\esp_idf_vsc_ext.log`
- Linux & MacOSX: `$HOME/.vscode/extensions/espressif.esp-idf-extension-VERSION/esp_idf_vsc_ext.log`