Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading include subpaths #3778

Closed
Anton-V-K opened this issue Oct 12, 2020 · 2 comments
Closed

Misleading include subpaths #3778

Anton-V-K opened this issue Oct 12, 2020 · 2 comments

Comments

@Anton-V-K
Copy link

I tried to build part of the libary in Arduino IDE (for esp8266), and immediatey faced strange include path in mbedtls/md.h like:

#include "mbedtls/config.h"

and then in standard mbedtls/config.h:

#include "mbedtls/check_config.h"

Fortunately the first case is easy to tune, so I have to include the libary this way:

#define MBEDTLS_CONFIG_FILE "config.h"
#include "mbedtls/md.h"

And I'll have to prepare custom config.h just to work around misleading subpath - mbedtls/check_config.h.

As far as I know the double quotes around an include path instructs the compiler to search from the current folder, which is meaningless in above mentioned cases, since there are no mbedtls/mbedtls/config.h or mbedtls/mbedtls/check_config.h.

Both these includes should be rewritten as

#include "config.h"

and

#include "check_config.h"

Optionally (to maintain backward comparibitliy) the same trick may be employed as it is done for config.h in md.h:

#if !defined(MBEDTLS_CHECK_CONFIG_FILE)
#include "mbedtls/check_config.h"
#else
#include MBEDTLS_CHECK_CONFIG_FILE
#endif
@daverodgman
Copy link
Contributor

It sounds like an include path problem - I think you need to add the directory named "include" to your include path. I'm not sure how this is done in the Arduino environment, though (modifying platform.txt seems to be one option). When this is done, includes like #include "mbedtls/config.h" should work properly.

@Anton-V-K
Copy link
Author

Anton-V-K commented Aug 3, 2023

Same or similar issue with include paths was already reported earlier as #857, #1225 and #2360 , and partially addressed in #2319. I wonder why the approach had been changed since then.

Anyway resolving this path problem for Arduino IDE is tricky, and I doubt the approach with hacking platform.txt is a way to go, since this file is user-specific (or machine-specific), while mbedtls is project-specific (may be cloned as a subproject).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants