Symbols error on windows build using ESP-IDF 4.1
Posted: Fri Dec 20, 2019 6:09 pm
I have been using Legacy GNU make with ESP-IDF 4.0 and toolchain from 3.3 stable for some time.
The application built and ran ok.
I attempted to use ESP-IDF 4.1 legacy with toolchain esp32-2019r2. That combination built my application code but failed to link reporting an issue with pthread linkage (viewtopic.php?f=2&t=13563#p53403)
So I then attempted to convert to CMake (EDIT: because a small example failed pthred linkage as a GNU legacy build but was fine as a Cmake build). I now get several linking errors from my own routines (which used to link) - I have swapped one problem for another.
For example the following complains that I am missing my HTTP content type lookup function (a simple file extension to content type):
The calling code is (WebAppRequestServer.cpp, libWebApp.a):
and the called routine is (HttpCommon, libPlatforms.a):
tells me:
Tells me:
So reference and declaration seem the same to me.
The errors seem centred around three files (HttpCommon.cpp, HttpPath.cpp, HttpFileServer.cpp) in one folder '/Platforms/Common/src' - but not all the files in that folder!
The files exist in the CMakeList.txt
EDIT: Seems to me that I am missing something obvious. My directory structure is a little convoluted, I need to refactor sure, but a static library is a static library! Why then missing symbols!
The application built and ran ok.
I attempted to use ESP-IDF 4.1 legacy with toolchain esp32-2019r2. That combination built my application code but failed to link reporting an issue with pthread linkage (viewtopic.php?f=2&t=13563#p53403)
So I then attempted to convert to CMake (EDIT: because a small example failed pthred linkage as a GNU legacy build but was fine as a Cmake build). I now get several linking errors from my own routines (which used to link) - I have swapped one problem for another.
For example the following complains that I am missing my HTTP content type lookup function (a simple file extension to content type):
Code: Select all
c:/users/pete/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/WebApp/libWebApp.a(WebAppRequestServer.cpp.obj):(.literal._ZN19WebAppRequestServer7RequestEP12IHttpRequestP13IHttpResponse+0x44): undefined reference to `HttpContentType(char const*)'
Code: Select all
HTTP_HANDLER_RESULT WebAppRequestServer::Request(IHttpRequest *request, IHttpResponse *response)
{
response->SetHeader(HttpHeaderContentType, HttpContentType(".json"));
Code: Select all
const char *HttpContentType(const char *filename)
{
Code: Select all
nm libPlatforms.a
Code: Select all
HttpCommon.cpp.obj:
00000000 T _Z15HttpContentTypePKc
U _ZN9MimeTypes7getTypeEPKc
00000000 D HttpHeaderCacheControl
00000000 D HttpHeaderCacheControlNoStore
00000000 D HttpHeaderContentEncoding
00000000 D HttpHeaderContentType
U printf
Code: Select all
nm libWebApp.a
Code: Select all
WebAppRequestServer.cpp.obj:
U __cxa_allocate_exception
U __cxa_free_exception
U __cxa_pure_virtual
U __cxa_throw
U __gxx_personality_v0
00000000 t _GLOBAL__sub_D__Z12ParseBooleanNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
00000000 t _GLOBAL__sub_I__Z12ParseBooleanNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
U _Unwind_Resume
00000000 T _Z12ParseBooleanNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
U _Z15HttpContentTypePKc
The errors seem centred around three files (HttpCommon.cpp, HttpPath.cpp, HttpFileServer.cpp) in one folder '/Platforms/Common/src' - but not all the files in that folder!
The files exist in the CMakeList.txt
EDIT: Seems to me that I am missing something obvious. My directory structure is a little convoluted, I need to refactor sure, but a static library is a static library! Why then missing symbols!