Seems like this is a common problem lately so I decided to wait a bit. I was nicely surprised to see that 1.9.0 of the ESPRESSIF platform was just released. Unfortunately the problem persists.
I keep getting an undefined reference error when linking the hmac_sha1 function. My project references the wpa2 functions of esp-idf and even the sntp lwip app which the linker has no problems with.
As far as I can tell I’m using the latest of everything under the VS Code IDE.
Thank you for the reply. It really helped get me unstuck.
The problem is that I’m programming in C++ but some the esp-idf source files do not appropriately apply ‘extern “C”’ to their definitions. In my case, the function hmac_sha1() lacks the extern “C” when my C++ code references it. I guess it went unnoticed since it is a sub-component of the wpa_supplicant code that usually would not be referenced directly by the application.
The solution is simply to wrap the “for C-only” header like this:
extern “C” {
<crypto/sha1.h>
}
The issue can be replicated by renaming the main.c file to main.cpp.