I have tried to solve this problem by having different configuration for platformio.ini file, specfically adding lib_ignore, lib_ldf_mode and lib_compat_mode but it is just me getting frustrated.
A brief overview of this particular problem is, that I have this include guard in one of my files,
#if defined CERT_ED25519
#elif defined CERT_P256
and in my platformio.ini file I have build_flags set to -DCERT_ED25519. However it still tries to include the ECC256.h library and would encounter many errors.
Also, I have tried removing that #include “ECC256.h” line from above, and it still continues to try to compile that! This is happening despite only being the only #include “ECC256.h” line in the entire project.
It is then I realized it is not the macros issue, as they are still trying to include the ECC256 library without it even being mentioned in the main or its current dependencies. But this is really strange, why would platformio ever be trying to build it.
Hopefully someone else has encountered this problem too, and have some insight into this strange bug.
Hi, I have exactly the same problem with PlatformIO and VSCode with a project that should build on two platforms (Mega2560 and Due). Compiling starts fine for both platforms, one after the other, but despite the fact that one incompatible and unnecessary library should not be included in the Due version, it is nevertheless compiled! Same like you, even removing all #include references does not help.
The problem seems to be that both of us are using libraries located in subdirectories in the project and do not refer to the general library folder. I think this is where lib_ignore etc. would come into play.
I think I found the solution: In the respective architecture’s [env] section, add the following line:
src_filter = +< * > -<path/to/library/ * > -<path/to/library2/file. * >
(remove spaces before and after asterisks, won’t display here otherwise)
This includes all files at first (+<*>) but then excludes path/to/library as well files matching “file.*” from path/to/library2 (all paths are relative to /src).
Yes, I did, and it did not work. As mentioned in the last paragraph of my previous post, “the problem seems to be that both of us are using libraries located in subdirectories in the project and do not refer to the general library folder. I think this [general/global libraries] is where lib_ignore etc. would come into play.” So if I used one of the libraries installed via PlatformIO, it would work, but not when using one that I provide on my own in a subdirectory.