...
-- Build files have been written to: C:/Code/ESP/esp-mdf/examples/get-started/build/bootloader
[9/13] Linking CXX executable get_started.elf
FAILED: get_started.elf
cmd.exe /C "cd . && C:\Users\admin\.espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-g++.exe -mlongcalls -Wno-frame-address @CMakeFiles\get_started.elf.rsp -o get_started.elf && cd ."
c:/users/admin/.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.exe: esp-idf/main/libmain.a(get_started.c.obj):(.literal.root_task+0x20): undefined reference to `mdf_heap_malloc'
c:/users/admin/.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.exe: esp-idf/main/libmain.a(get_started.c.obj): in function `root_task':
c:\code\esp\esp-mdf\examples\get-started\build/../main/get_started.c:25: undefined reference to `mdf_heap_malloc'
c:/users/admin/.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.exe: esp-idf/main/libmain.a(get_started.c.obj): in function `node_read_task':
c:\code\esp\esp-mdf\examples\get-started\build/../main/get_started.c:47: undefined reference to `mdf_heap_malloc'
c:/users/admin/.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.exe: esp-idf/main/libmain.a(get_started.c.obj): in function `node_write_task':
c:\code\esp\esp-mdf\examples\get-started\build/../main/get_started.c:76: undefined reference to `mdf_heap_malloc'
c:/users/admin/.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.exe: esp-idf/mwifi/libmwifi.a(mwifi.c.obj):(.literal.mwifi_init+0x34): undefined reference to `mdf_heap_calloc'
c:/users/admin/.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.exe: esp-idf/mwifi/libmwifi.a(mwifi.c.obj):(.literal.mwifi_transmit_write+0x18): undefined reference to `mdf_heap_realloc'
c:/users/admin/.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.exe: esp-idf/mwifi/libmwifi.a(mwifi.c.obj): in function `mwifi_init':
C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:297: undefined reference to `mdf_heap_calloc'
c:/users/admin/.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.exe: C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:301: undefined reference to `mdf_heap_calloc'
c:/users/admin/.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.exe: esp-idf/mwifi/libmwifi.a(mwifi.c.obj): in function `mwifi_transmit_write':
C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:739: undefined reference to `mdf_heap_realloc'
c:/users/admin/.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.exe: C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:745: undefined reference to `mdf_heap_realloc'
c:/users/admin/.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.exe: esp-idf/mwifi/libmwifi.a(mwifi.c.obj): in function `mwifi_write':
C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:887: undefined reference to `mdf_heap_malloc'
c:/users/admin/.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.exe: C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:907: undefined reference to `mdf_heap_malloc'
c:/users/admin/.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.exe: esp-idf/mwifi/libmwifi.a(mwifi.c.obj): in function `__mwifi_read':
C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:978: undefined reference to `mdf_heap_realloc'
c:/users/admin/.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.exe: C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:1034: undefined reference to `mdf_heap_realloc'
c:/users/admin/.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.exe: C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:1098: undefined reference to `mdf_heap_realloc'
c:/users/admin/.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.exe: C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:1118: undefined reference to `mdf_heap_realloc'
c:/users/admin/.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.exe: esp-idf/mwifi/libmwifi.a(mwifi.c.obj): in function `mwifi_root_write':
C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:1185: undefined reference to `mdf_heap_malloc'
c:/users/admin/.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.exe: C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:1220: undefined reference to `mdf_heap_malloc'
c:/users/admin/.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.exe: C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:1247: undefined reference to `mdf_heap_malloc'
c:/users/admin/.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.exe: esp-idf/mwifi/libmwifi.a(mwifi.c.obj): in function `__mwifi_root_read':
C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:1298: undefined reference to `mdf_heap_realloc'
c:/users/admin/.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.exe: C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:1349: undefined reference to `mdf_heap_realloc'
c:/users/admin/.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.exe: C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:1360: undefined reference to `mdf_heap_realloc'
c:/users/admin/.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.exe: C:/Code/ESP/esp-mdf/components/mwifi/mwifi.c:1378: undefined reference to `mdf_heap_realloc'
collect2.exe: error: ld returned 1 exit status
Hi @Dee-Fuse.
You can use O2 level optimization rather than Os. I found that the inline function defined in the header file will be optimized by the compiler(v8.2.0 or v8.4.0).
Environment
git rev-parse --short HEAD
to get the commit id.): 1c76187Problem Description
Setting
Optimization Level
to-Os
or-O0
results in linker not finding certain mdf functions (See Log)Expected Behavior
Compilation + Linking should work as with
-Og
Actual Behavior
Linking fails with undefined references
Steps to repropduce
idf.py menuconfig
> Compiler Options > Optimization Level-Os
and saveidf.py build