Cannot find IDF_PATH/components

dr_glenn
Posts: 8
Joined: Sun May 26, 2024 9:22 pm

Cannot find IDF_PATH/components

Postby dr_glenn » Thu May 22, 2025 12:53 am

Project fails to compile, cannot find esp_sleep.h. I am using ESP-IDF v5.4 in VSCode in Windows 11 Pro. I have never had a problem like this with other ESP-IDF projects. I believe this is a problem in c_cpp_properties.json (found in .vscode directory). And I think the problem ultimately arises from the not normal subdir structure and the various CMakeLists file (see below). Here is "includePath" from c_cpp_properties:

Code: Select all

      "includePath": [
        "${config:idf.espIdfPath}/components/**",
        "${config:idf.espIdfPathWin}/components/**",
        "${workspaceFolder}/**"
      ],
The first line, is underlined in red (error) and the error is:
Cannot find: "${env:IDF_PATH}/components/"
It seems strange that there is no error with espIdfPathWin.
When I use command palette to run "ESP-IDF: Doctor Command" it reports:
ESP-IDF Path (idf.espIdfPath) C:<HOMEPATH>\esp\v5.4\esp-idf
The components are there (otherwise none of my other projects would compile). Also in file build/config.env it does show
"IDF_PATH": "C:/Users/glenn/esp/v5.4/esp-idf"
However, this project is unusual because the app_main is not in the usual subdir and I've had to alter CMakeLists files from the normal. I am trying to build from code with directory structure bb_epaper/esp_idf/mini_epaper_s3/main (yes, the dir is esp_idf, not esp-idf).
Here are the CMakeLists files:
Top (bb_epaper):

Code: Select all

cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(my_bb_paper)
add_subdirectory(esp_idf/mini_epaper_s3)
esp_idf: no CMakeLists file.

mini_epaper_s3:

Code: Select all

cmake_minimum_required(VERSION 3.16)
add_executable(my_app main/mini_epaper_s3.c)
main:

Code: Select all

set(COMPONENT_SRCS "mini_epaper_s3.c")
set(COMPONENT_ADD_INCLUDEDIRS "")
set(COMPONENT_REQUIRES soc nvs_flash ulp driver esp_hw_support)

register_component()

#
# ULP support additions to component CMakeLists.txt.
#
# 1. The ULP app name must be unique (if multiple components use ULP).
set(ulp_app_name ulp_${COMPONENT_NAME})
#
# 2. Specify all C and Assembly source files.
#    Files should be placed into a separate directory (in this case, ulp/),
#    which should not be added to COMPONENT_SRCS.
set(ulp_riscv_sources "ulp/main.c")

#
# 3. List all the component source files which include automatically
#    generated ULP export file, ${ulp_app_name}.h:
set(ulp_exp_dep_srcs ${app_sources})

#
# 4. Call function to build ULP binary and embed in project using the argument
#    values above.
ulp_embed_binary(${ulp_app_name} "${ulp_riscv_sources}" "${ulp_exp_dep_srcs}")
I don't know what other info I should include here. I hope this is enough - and not too much.

kondalkolipaka
Espressif staff
Espressif staff
Posts: 269
Joined: Wed Jul 17, 2019 5:26 pm

Re: Cannot find IDF_PATH/components

Postby kondalkolipaka » Fri May 23, 2025 12:47 pm

Hello,

Could you replace add_subdirectory(esp_idf/mini_epaper_s3) with the set(EXTRA_COMPONENT_DIRS "esp_idf/mini_epaper_s3") see if that helps?

Code: Select all

set(EXTRA_COMPONENT_DIRS "esp_idf/mini_epaper_s3")
More on this here - https://docs.espressif.com/projects/esp ... -component

Screenshot 2025-05-23 at 6.15.32 PM.png
Screenshot 2025-05-23 at 6.15.32 PM.png (671.42 KiB) Viewed 1378 times
Thanks

mikl604
Posts: 44
Joined: Thu Aug 24, 2023 3:15 pm

Re: Cannot find IDF_PATH/components

Postby mikl604 » Mon May 26, 2025 8:20 am

I found such a bug (or feature) :)
If you upload a project with the "Search for nested projects" field marked, then a bunch of errors about undiscovered libraries appear. And if you download with the "Search for nested projects" unchecked, then everything compiles normally.
Attachments
1.png
1.png (45.88 KiB) Viewed 1365 times
2.png
2.png (31.81 KiB) Viewed 1365 times
3.png
3.png (46.97 KiB) Viewed 1365 times

dr_glenn
Posts: 8
Joined: Sun May 26, 2024 9:22 pm

Re: Cannot find IDF_PATH/components

Postby dr_glenn » Mon May 26, 2025 8:15 pm

Hello,

Could you replace add_subdirectory(esp_idf/mini_epaper_s3) with the set(EXTRA_COMPONENT_DIRS "esp_idf/mini_epaper_s3") see if that helps?

Code: Select all

set(EXTRA_COMPONENT_DIRS "esp_idf/mini_epaper_s3")
More on this here - https://docs.espressif.com/projects/esp ... -component
I followed your advice (and replied a few days ago, but my reply got lost somehow). You got me further but I still cannot complete the build. I get a FAILED status at:

Code: Select all

[942/1032] Building C object esp-idf/esp_lcd/CMakeFiles/__idf_esp_lcd.dir/rgb/esp_lcd_panel_rgb.c.obj
FAILED: esp-idf/esp_lcd/CMakeFiles/__idf_esp_lcd.dir/rgb/esp_lcd_panel_rgb.c.obj
The error occurs in ESP-IDF component code! Worse yet, an "internal compiler error"???

Code: Select all

C:/Users/glenn/Documents/ESP32/my_bb_paper/components/esp_lcd/rgb/esp_lcd_panel_rgb.c: In function 'rgb_panel_draw_bitmap':
C:/Users/glenn/Documents/ESP32/my_bb_paper/components/esp_lcd/rgb/esp_lcd_panel_rgb.c:686:1: internal compiler error: Segmentation fault
  686 | }
      | ^
Please submit a full bug report, with preprocessed source (by using -freport-bug).

dr_glenn
Posts: 8
Joined: Sun May 26, 2024 9:22 pm

Re: Cannot find IDF_PATH/components

Postby dr_glenn » Mon May 26, 2025 8:29 pm

I found such a bug (or feature) :)
If you upload a project with the "Search for nested projects" field marked, then a bunch of errors about undiscovered libraries appear. And if you download with the "Search for nested projects" unchecked, then everything compiles normally.
Interesting, but not relevant to my problem.

dr_glenn
Posts: 8
Joined: Sun May 26, 2024 9:22 pm

Re: Cannot find IDF_PATH/components

Postby dr_glenn » Tue May 27, 2025 12:21 am

I noted that I'm now seeing this error:

Code: Select all

/esp-idf/components/esp_lcd/rgb/esp_lcd_panel_rgb.c:686:1: internal compiler error: Segmentation fault
Other people have seen this error and it has been filed at https://github.com/espressif/esp-idf/issues/12180.
Based on this report, I think the bug appears with ESP-IDF v5.x, but it seems likely that the problem is with the compiler and not the source code.
If I can get past this problem, I think my trouble with setting correct CMakeLists files has been resolved.

Who is online

Users browsing this forum: No registered users and 1 guest