Undefined reference to `btdm_rf_bb_reg_init' when compiling previously working esp32 program

I have always been able to compile my Arduino framework esp32 program.
I made a truly trivial change to the code tonight and encountered a new linking error whereby libcoexist.a has an undefined reference to btdm_rf_bb_reg_init as follows:

Linking .pio\build\node32s-sprinkplug\firmware.elf
c:/users/myuser/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\myuser\.platformio\packages\framework-arduinoespressif32\tools\sdk\esp32\lib\libcoexist.a(coexist_hw.o):(.iram1.18+0x0): undefined reference to `btdm_rf_bb_reg_init'
c:/users/myuser/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\myuser\.platformio\packages\framework-arduinoespressif32\tools\sdk\esp32\lib\libcoexist.a(coexist_hw.o):(.iram1.18+0x16): undefined reference to `btdm_rf_bb_reg_init'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\node32s-sprinkplug\firmware.elf] Error 1

I believe that btdm_rf_bb_reg_init has something to do with bluetooth but I am not using or referencing bluetooth in any way in my code (I use WiFi).

The only libraries I include are:

//Basic Arduino/esp32 Libraries
#include <Arduino.h>
#include <WiFi.h>
#include <WiFiMulti.h>
#include <esp_wifi.h> //Needed to set MAC address
#include <EEPROM.h>	  //Needed to store variables permanently to EEPROM
#include <ArduinoOTA.h> //Needed for OTA updates
#include <time.h>	  // Needed to get date & time
//#include <ESP32Ping.h> //DEBUG

//Sensor libraries
#include "Adafruit_BME680.h"
#include "Adafruit_MCP9808.h"

//MQTT Libraries
#include <ArduinoJson.h>
#include "PubSubClient.h"

If I do a grep on the .build directory for btdm_rf_bb_reg_init, I get:

grep -r btdm_rf_bb_reg_init .
./.pio/build/node32s-sprinkplug/firmware.map:btdm_rf_bb_reg_init                               C:\Users\myuser\.platformio\packages\framework-arduinoespressif32\tools\sdk\esp32\lib\libcoexist.a(coexist_hw.o)

I tried wiping the build and libdeps subdirectory and compiling again, but I still got the error.

I ran pio update and pio pkg update so everything is up-to-date (I am using platformio/espressif32 @ 6.9.0). Compiling shows the follow package versions:

PACKAGES:
 - framework-arduinoespressif32 @ 3.20017.0 (2.0.17)
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 42 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Adafruit BME680 Library @ 2.0.5
|-- Adafruit MCP9808 Library @ 2.0.2
|-- PubSubClient @ 2.8.0
|-- ArduinoJson @ 7.2.0
|-- ArduinoOTA @ 2.0.0
|-- EEPROM @ 2.0.0
|-- WiFi @ 2.0.0

Note that reverting my trivial change didn’t eliminate the error so it seems like something has changed in espressif and/or Arduino libraries.

  • Any idea what could have changed that would cause this compilation error?
  • Any idea on how to fix this?

Did you solve this poblem?

Ok. It seems another project modified the platformio platform expressif32. I didn’t find out what was changed. So I uninstalled and installed the expressif32 platform, whih solved the problem.

Platforms are installed globally.
If the project does not specify the exact platform version and several platform versions are installed, the one with the highest version number is used.