Build fails (undefined reference to typeinfo for BTAdvertisedDevice)

I can’t build my project from last year on my new computer, but it does still build on the old machine: https://github.com/barafael/dodeca-blink
This also fails in CI, so it could be that this relates to a newer version of platformio, the compiler, or the linker?

On that old machine, what is the output of pio --version and pio platform show espressif32 on the CLI?

On old machine:

> pio --version:
PlatformIO Core, version 6.1.4

> pio platform show espressif32

WARNING: This command is deprecated and will be removed in the next releases. 
Please use `pio pkg show` instead.


platformio/espressif32
Platform • 5.2.0 • Public • Published on Fri Sep 30 09:55:44 2022

Espressif Systems is a privately held fabless semiconductor company. They provide wireless communications and Wi-Fi chips which are widely used in mobile devices and the Internet of Things applications.

---------------------  ----------------------------------------------------------------
Registry               https://registry.platformio.org/platforms/platformio/espressif32
Homepage               https://espressif.com/
Repository             https://github.com/platformio/platform-espressif32.git
License                Apache-2.0
Popularity             1
Stars                  588
Examples               20
Installed Size         1.46MB
Dependencies           19
Compatible Frameworks  arduino, espidf
Keywords               dev-platform, wi-fi, bluetooth, xtensa, risc-v
---------------------  ----------------------------------------------------------------

Version    Size      Published
---------  --------  -------------------
5.2.0      293.90KB  2022-09-30 09:55:44
5.1.1      292.81KB  2022-08-26 13:21:05
5.1.0      293.46KB  2022-07-31 19:17:02
5.0.0      290.96KB  2022-06-30 14:56:44
4.4.0      293.64KB  2022-05-31 18:03:16
4.3.0      294.03KB  2022-05-20 17:31:55
4.2.0      291.41KB  2022-04-29 11:16:29
4.1.0      291.08KB  2022-04-21 13:47:06
4.0.0      290.99KB  2022-04-21 13:44:46
3.5.0      289.23KB  2022-01-28 13:18:31
3.4.0      290.02KB  2021-11-12 11:09:53
3.3.2      283.57KB  2021-08-31 13:44:07
3.3.1      283.75KB  2021-07-26 18:19:16
3.3.0      283.61KB  2021-06-30 11:40:13
3.2.1      283.70KB  2021-05-31 13:46:30
3.2.0      283.25KB  2021-03-29 12:33:46
3.1.1      283.28KB  2021-03-18 22:02:04
3.1.0      283.15KB  2021-02-26 13:42:10
3.0.0      278.80KB  2021-01-29 19:29:52
2.1.0      274.87KB  2020-12-02 14:45:17
2.0.0      273.40KB  2020-09-07 12:01:34
1.12.4     255.12KB  2020-06-17 10:41:53
1.12.3     254.88KB  2020-06-11 10:54:22
1.12.2     254.64KB  2020-05-25 13:15:26
1.12.1     255.42KB  2020-04-28 12:08:20
1.12.0     254.02KB  2020-03-23 15:12:35
1.11.2     199.07KB  2020-02-12 21:53:38
1.11.1     198.20KB  2019-11-01 16:47:34
1.11.0     197.99KB  2019-10-04 18:14:39
1.10.0     197.81KB  2019-09-18 15:52:55
1.9.0      116.43KB  2019-06-28 12:26:54
1.8.0      97.71KB   2019-04-19 10:25:30
1.7.0      90.48KB   2019-02-22 17:06:20
1.6.0      90.30KB   2019-01-11 12:27:40
1.5.0      89.31KB   2018-11-05 16:29:09
1.4.0      62.77KB   2018-10-01 13:28:27
1.3.0      51.99KB   2018-08-13 15:05:07
1.2.0      51.80KB   2018-07-30 18:03:16
1.1.2      37.98KB   2018-07-06 12:20:41
1.1.1      37.99KB   2018-07-04 22:05:20
1.1.0      38.00KB   2018-07-02 13:18:41
1.0.2      37.85KB   2018-06-04 15:24:27
1.0.1      37.67KB   2018-05-31 18:40:50
1.0.0      37.60KB   2018-05-30 16:28:06
0.12.0     31.45KB   2018-02-08 14:17:46
0.11.1     31.12KB   2018-02-08 14:16:34
0.11.0     31.32KB   2017-11-27 23:23:43
0.10.0     30.78KB   2017-09-05 13:25:45
0.9.1      30.32KB   2017-08-22 13:47:24
0.9.0      30.31KB   2017-08-16 15:02:00
0.8.0      29.68KB   2017-08-07 12:35:36
0.7.5      29.30KB   2017-07-04 16:26:22
0.7.0      28.12KB   2017-04-12 16:12:02
0.6.0      27.96KB   2017-02-22 14:21:25
0.5.0      18.50KB   2017-01-27 19:39:32
0.4.0      18.65KB   2016-12-24 14:51:15
0.3.0      17.46KB   2016-12-10 15:47:57
0.2.0      16.09KB   2016-12-07 19:33:27
0.1.0      16.28KB   2016-11-18 15:15:37

On new machine, fresh install. That’s a lead.

Well but it definitely doesn’t compile correctly with that version.

Just going by the date of the project, I tried the last platform-espressif32 version that was using the Arduino-ESP32 1.0.6 core, which per releases is 3.5.0, and it compiled immediately. So just set

platform = espressif32@3.5.0

instead of

platform = espressif32

in both esp32 environments.

On the current versions, the RTTI (runtime type information) flags do not seem to be correctly processed, so that build_unflags = [..] -fno-rtti doesn’t have the desired effect. There were previously some discussion on this in Force RTTI from library?. After a short round of trying though, I was unable to get that to compile with the extra_script.

For stability reasons, you’ll always want to pin the platform version like shown above.

1 Like

Thanks a lot, there’s a lesson to learn here :slight_smile: It works!
Probably, it would make sense to update the version at some point, but I’m certainly happy with this for now.

Somebody on reddit helped me find the root cause. espressif32 includes their own BluetoothSerial.{cpp/hpp} now, which caused the conflict with the types from mbed.

The solution was to set the

lib_ldf_mode = deep

and then remove the mbed dependency, after which everything worked flawlessly.