Strange compile errors after adding cmake component

glrtheil
Posts: 61
Joined: Tue Dec 07, 2021 2:48 pm

Strange compile errors after adding cmake component

Postby glrtheil » Thu May 19, 2022 3:36 pm

I recently added parson as a component to my project, and suddenly I'm getting an error when I try to compile and flash within VS code.

I added a CMakeLists.txt file for the parson component

Code: Select all

set(ROOT_PATH
    ${CMAKE_CURRENT_LIST_DIR}/../../..
)

idf_component_register(
	SRCS ${ROOT_PATH}/libs/parson/parson.c
    INCLUDE_DIRS ${ROOT_PATH}/libs/parson
)
I added parson to the REQUIRES entry of idf_component_register of my main component (very end)

Code: Select all

idf_component_register(SRCS "${srcs}"
                    INCLUDE_DIRS "${include_dirs}"
                    REQUIRES app_update esp_https_ota bt littlefs console freertos nvs_flash coreMQTT azure-sdk-for-c azure-iot-middleware-freertos azure-iot parson
                    EMBED_TXTFILES ${project_dir}/server_certs/ca_cert.pem)
A couple things happen after this change. If there's ANY change to the git repository, like I make a commit, undo a commit, pop a stash, etc. it's almost as if the build is cleaned because it requires a full rebuild as if it's been cleaned even though it's not.

If I try to build/flash from the command pallette of vscode, I get this:
> Executing task: ninja <

[0/1] Re-running CMake...
-- Building ESP-IDF components for target esp32
CMake Error at C:/Users/Ricky/esp/esp-idf/tools/cmake/build.cmake:191 (message):
Failed to resolve component 'littlefs'.
Call Stack (most recent call first):
C:/Users/Ricky/esp/esp-idf/tools/cmake/build.cmake:217 (__build_resolve_and_add_req)
C:/Users/Ricky/esp/esp-idf/tools/cmake/build.cmake:441 (__build_expand_requirements)
C:/Users/Ricky/esp/esp-idf/tools/cmake/project.cmake:399 (idf_build_process)
CMakeLists.txt:13 (project)


-- Configuring incomplete, errors occurred!
See also "C:/repos/ESPfw2/controller-firmware/build/CMakeFiles/CMakeOutput.log".
←[31mFAILED: ←[0mbuild.ninja
C:\Users\Ricky\.espressif\tools\cmake\3.16.4\bin\cmake.exe -SC:\repos\ESPfw2\controller-firmware -BC:\repos\ESPfw2\controller-firmware\build
ninja: error: rebuilding 'build.ninja': subcommand failed
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command ninja " terminated with exit code: 1.
Failed to resolve component littlefs? That makes no sense. However, if I run shift+ctrl+B to build, which runs "idf.py build", it runs and compiles just fine. After I do this, THEN I can use the command palette to build and flash, even after I make minor code changes. If I make a change to something related to cmake, or make a git transaction, I have to force rebuild everything first.

If I remove parson as a component, everything goes back to normal. I can build from clean using command palette, and when I do a git commit or other git action, I'm not required to rebuild from scratch. It's really weird. Any ideas why this is happening?

glrtheil
Posts: 61
Joined: Tue Dec 07, 2021 2:48 pm

Re: Strange compile errors after adding cmake component

Postby glrtheil » Tue May 31, 2022 2:35 pm

Bumping this. Need to find a solution, as this affects other developers on the project.

glrtheil
Posts: 61
Joined: Tue Dec 07, 2021 2:48 pm

Re: Strange compile errors after adding cmake component

Postby glrtheil » Fri Nov 18, 2022 10:06 pm

Finally figured this out. In vs code, open settings UI. GO to Extensions > ESP-IDF. Ensure "Enable Idf Component Manager" is checked. Run full clean then rebuild using the command palette.

Who is online

Users browsing this forum: danpf1 and 151 guests