esp-idf 4.0 build system does not find certain esp-idf include files

wevets
Posts: 112
Joined: Sat Mar 09, 2019 2:56 am

esp-idf 4.0 build system does not find certain esp-idf include files

Postby wevets » Thu Apr 30, 2020 6:08 am

I'm building an app with a main program and 5 custom components, which built just fine under esp-idf 3.0. It fails to build under idf v4.0 because the build system fails to find several idf include files, in particular for my app, esp_http_client.h and nvs.h. The fail message is, for example.
  1. ../components/nvstorage/PartBinNVS.c:10:10: fatal error: nvs.h: No such file or directory
  2.  #include "nvs.h"
  3.           ^~~~~~~
I know the include files are there in:
".../components/nvs_flash/include/nvs.h", and ".../components/esp_http_client/include/esp_http_client.h"

Many of the files that I "#include" in my sources are found. When compilation is terminated for failure of the build system to find these files, CMake (or is it ninja?) prints to the terminal a bunch of stuff with statements of the form:

"-IC:/Users/Steve/Desktop/esp-idf/components/freertos/include ", which I assume are default include paths supplied by the build system. I haven't verified this for all my include files, but the ones that I looked at are found through these system-supplied include paths.

I have 3 questions:
1. Where are the default include paths defined?

2. Why isn't every include path in the idf part of the default set of include paths?

3. What's the easiest most graceful way to get the paths to the include files I need into the include path set? Is it with statements in the CMakeLists.txt files that I define in my project (if so, what statement and where among the required statements) or elsewhere in the build system?

Thanks, as always, for your help.

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: esp-idf 4.0 build system does not find certain esp-idf include files

Postby ESP_Angus » Thu Apr 30, 2020 11:41 pm

Hi wevets,

One of the biggest changes in the CMake-based build system is that components (apart from "main") don't automatically include the public header files of all other components. Each component has to declare the components that it requires

This allows the build to be faster, and also provides a way to configure a project to build the minimal required set of components. It's also one of the steps to the IDF Component Manager (ie package manager) that we plan to introduce.

You can read an explanation of how this works, and what to add to your components, here:
https://docs.espressif.com/projects/esp ... quirements


Angus

Junior
Posts: 3
Joined: Sat Sep 07, 2019 7:23 am

Re: esp-idf 4.0 build system does not find certain esp-idf include files

Postby Junior » Sat May 02, 2020 12:40 pm

Add
  1. REQUIRES "nvs_flash"
to your component.

wevets
Posts: 112
Joined: Sat Mar 09, 2019 2:56 am

Re: esp-idf 4.0 build system does not find certain esp-idf include files

Postby wevets » Mon May 04, 2020 6:27 am

ESP_Angus and Junior,

Thanks for your pointers and help. I've got my app building under cmake now.

Who is online

Users browsing this forum: Baidu [Spider] and 105 guests