All REQUIRES missing in the CMakeLists.txt

brazoayeye
Posts: 41
Joined: Sun May 03, 2020 2:37 pm

All REQUIRES missing in the CMakeLists.txt

Postby brazoayeye » Mon Jun 21, 2021 10:04 am

Hello,

I'm updating a project from version 3.0.9 to 4.3 release, and I'm fixing legacy code to have a compiling version.

I installed the VS Code pluign, and compiled example project without (remaining) problems.

My current CMakeList is something like

Code: Select all

idf_component_register(INCLUDE_DIRS "." "addrs" "button" "certs"
                       SRC_DIRS  "." "addrs" "button" "certs"
                       EMBED_TXTFILES "certs/ca.crt"
                       EMBED_FILES "web/bin/style.css.min.gz")
Now I'm fixing the code and I'm facing a linking problem, for example
undefined reference to `mbedtls_md5_starts'
The compilation seems to proceed further if I add the row

Code: Select all

REQUIRES "mbedtls"
but suddenly I face problems with others (nvs_flash, mdns, mqtt_client, ...)

With the old make, I didn't have this kind of problem (no REQUIRES equivalent needed), so I'm thinking I should setup something better. Should I REQUIRES all packages, or is there something to setup to solve the problem?

Thanks

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

Re: All REQUIRES missing in the CMakeLists.txt

Postby ESP_Angus » Mon Jun 21, 2021 11:31 pm

Hi brazoaeye,

Sorry for the inconvenience of having your components no longer build. This was a deliberate design decision in order to optimize the build process, especially the linking part of the build, and encourage hierarchical component design.

You can read about component requirements in the docs here:
https://docs.espressif.com/projects/esp ... quirements

Listing all of the components that your component depends on (i.e. "REQUIRES mbedtls nvs_flash mdns mqtt_client") is the recommended solution. Although if the component is only needed for the implementation and not the interface, you can add it to PRIV_REQUIRES instead (explanation at the link above.)

Who is online

Users browsing this forum: axellin, Google [Bot], ok-home and 106 guests