PlatformIO Community

ESP32-IDF, Linker problem


#1

I try to compile ESP-IDF Bluetooth SPP example. It works whith ESP-IDF toolchain.

VSCode + Platformio: Compilation is OK, problem is:
Linking .pioenvs/esp32dev/firmware.elf
.pioenvs/esp32dev/src/example_spp_acceptor_demo.o:(.literal.esp_bt_gap_cb+0x20): undefined reference to esp_bt_gap_pin_reply' .pioenvs/esp32dev/src/example_spp_acceptor_demo.o:(.literal.esp_spp_cb+0x48): undefined reference toesp_bt_gap_set_scan_mode’
.pioenvs/esp32dev/src/example_spp_acceptor_demo.o:(.literal.esp_spp_cb+0x4c): undefined reference to esp_spp_start_srv' .pioenvs/esp32dev/src/example_spp_acceptor_demo.o:(.literal.app_main+0x48): undefined reference toesp_bt_gap_register_callback’
.pioenvs/esp32dev/src/example_spp_acceptor_demo.o:(.literal.app_main+0x4c): undefined reference to esp_spp_register_callback' .pioenvs/esp32dev/src/example_spp_acceptor_demo.o:(.literal.app_main+0x50): undefined reference toesp_spp_init’
.pioenvs/esp32dev/src/example_spp_acceptor_demo.o:(.literal.app_main+0x54): undefined reference to esp_bt_gap_set_pin' .pioenvs/esp32dev/src/example_spp_acceptor_demo.o: In functionesp_bt_gap_cb’:
example_spp_acceptor_demo.c:(.text.esp_bt_gap_cb+0xbf): undefined reference to esp_bt_gap_pin_reply' .pioenvs/esp32dev/src/example_spp_acceptor_demo.o: In functionesp_spp_cb’:
example_spp_acceptor_demo.c:(.text.esp_spp_cb+0x7b): undefined reference to esp_bt_gap_set_scan_mode' example_spp_acceptor_demo.c:(.text.esp_spp_cb+0x8a): undefined reference toesp_spp_start_srv’
.pioenvs/esp32dev/src/example_spp_acceptor_demo.o: In function app_main': example_spp_acceptor_demo.c:(.text.app_main+0x124): undefined reference toesp_bt_gap_register_callback’
example_spp_acceptor_demo.c:(.text.app_main+0x154): undefined reference to esp_spp_register_callback' example_spp_acceptor_demo.c:(.text.app_main+0x181): undefined reference toesp_spp_init’
example_spp_acceptor_demo.c:(.text.app_main+0x1b3): undefined reference to `esp_bt_gap_set_pin’
collect2: error: ld returned 1 exit status
*** [.pioenvs/esp32dev/firmware.elf] Error 1

If i click “Go to definition” on esp_bt_gap_pin_reply function, .platformio/packages/framework-espidf/components/bt/bluedroid/api/include/api/esp_gap_bt_api.h file open.

Based on the error message, the linker cannot find the esp_bt_gap_pin_reply function.
In the ~/.platformio/packages/framework-espidf/components/bt/bluedroid/api directory there is an esp_gap_bt_api.c file and there is an esp_bt_gap_pin_reply() function in it. In the header ~/.platformio/packages/framework-espidf/components/bt/bluedroid/api/include/api/esp_gap_bt_api.h file file declaration is also there.

During compilation, there is “Compiling .pioenvs/esp32dev/bt/bluedroid/api/esp_gap_bt_api.o”
Full compilation output - https://pastebin.com/1EDqA7jN
Full code - https://pastebin.com/rRci5gUT


#2

Please report issue to https://github.com/platformio/platform-espressif32/issues


#3

I have the same problem.Did you find the solution?