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

Cannot link espcoredump to my app (IDFGH-4780) #6583

Closed
0xFEEDC0DE64 opened this issue Feb 20, 2021 · 3 comments
Closed

Cannot link espcoredump to my app (IDFGH-4780) #6583

0xFEEDC0DE64 opened this issue Feb 20, 2021 · 3 comments
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@0xFEEDC0DE64
Copy link
Contributor

I'm using esp-idf v4.4-dev and I try to implement automatic upload of coredumps from the partition into the cloud.

I added espcoredump to my REQUIRES in CMakeLists.txt and including the header <esp_core_dump.h> already works, but when I use the method esp_core_dump_image_get() I get the following linker error:

~/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(webserver.cpp.obj):(.literal._ZN3goe12_GLOBAL__N_122webserver_dump_handlerEP9httpd_req+0x40): undefined reference to `esp_core_dump_image_get(unsigned int*, unsigned int*)'
~/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(webserver.cpp.obj): in function `goe::(anonymous namespace)::webserver_dump_handler(httpd_req*)':
~/<MY-PROJECT>/build/../main/webserver.cpp:78: undefined reference to `esp_core_dump_image_get(unsigned int*, unsigned int*)'
collect2: error: ld returned 1 exit status

How is the espcoredump component different from all the other ones provided by espressif?

Some background: I try to get the offset & size of the coredump (I noticed I need to cut off 20 bytes at the beginning when using flash mmap apis). And I would also like to verify the checksum before submitting and erase the whole partition after successful upload.

@github-actions github-actions bot changed the title Cannot link espcoredump to my app Cannot link espcoredump to my app (IDFGH-4780) Feb 20, 2021
@igrr
Copy link
Member

igrr commented Feb 20, 2021

Hi @0xFEEDC0DE64, the issue is that esp_core_dump.h file doesn't have C++ include guards, so when you include it from a C++ source file the function gets declared with C++ linkage. The linker can not find the actual definition of the function due to name mangling.
As a workaround, please include esp_core_dump.h like this:

extern "C" {
#include "esp_core_dump.h"
}

We will fix this by adding C++ include guards to this file. This issue will be closed automatically when the fix is merged.

@0xFEEDC0DE64
Copy link
Contributor Author

since merged can be closed, thanks everyone

@espressif-bot espressif-bot added Resolution: Done Issue is done internally Status: Done Issue is done internally labels Jul 20, 2021
@tsctrl
Copy link

tsctrl commented Jul 20, 2021

having similar issue, thanks @igrr , @0xFEEDC0DE64 for the fixes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

4 participants