A project with a component that requires another component

mrdebug
Posts: 42
Joined: Sat Jul 27, 2019 8:26 am

A project with a component that requires another component

Postby mrdebug » Mon Dec 09, 2019 1:33 pm

Hi, I have a project with a component called component01.
The component requires
#include "mbedtls/base64.h"
When I try to compile I obtain this error:
fatal error: mbedtls/base64.h: No such file or directory
but the error does not happens if I add the same include in main.c
How can I use the header
#include "mbedtls/base64.h"
in my component01?

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: A project with a component that requires another component

Postby PeterR » Mon Dec 09, 2019 2:17 pm

You would need to post your make files and a screen grab of your folder structure.

I have not used mbedtls but you include most esp components without directory path e.g.

Code: Select all

#include "esp_spiffs.h"
#include "esp_vfs_httpfs.h"
#include "esp_vfs.h"
#include "esp_vfs_fat.h"
For this to work the component (esp or your own) must be in /components
& I also believe that IDF CAN should be fixed.

mrdebug
Posts: 42
Joined: Sat Jul 27, 2019 8:26 am

Re: A project with a component that requires another component

Postby mrdebug » Mon Dec 09, 2019 3:06 pm

Please try to download this
http://www.denisgottardello.it/Test02.zip
and have a look at the behaviour.
As you can see the
#include "mbedtls/base64.h"
works in main.c but not in test01.h of the component

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: A project with a component that requires another component

Postby PeterR » Mon Dec 09, 2019 5:04 pm

I haven't switched to CMake yet but as an Gnu build you are missing component.mk is the component directory.
That may help.
& I also believe that IDF CAN should be fixed.

mrdebug
Posts: 42
Joined: Sat Jul 27, 2019 8:26 am

Re: A project with a component that requires another component

Postby mrdebug » Mon Dec 09, 2019 5:21 pm

How do you think I should populate the component.mk file in order to include mbedtls module?

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

Re: A project with a component that requires another component

Postby ESP_Angus » Tue Dec 10, 2019 4:24 am

If you're using CMake (or idf.py) then you don't need a component.mk file at all, just CMakeLists.txt.

In the CMake based build system, components need to declare their dependencies. So "component01" needs to declare that it requires the "mbedtls" component in order to include headers found in the mbedtls component.

To learn more, read here: https://docs.espressif.com/projects/esp ... quirements

Who is online

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