Build failed on new ESP32 project - xtensa g++ compiler not found #3713

See here. issue “After updating 32 bit Raspi OS Pi 4 is on 64bit kernel”

Workaround is

The switch to running a 64-bit kernel by default on Pi 4 is intentional.
We believe it gives a better experience with few drawbacks.
As you've found, you can revert to the 32-bit kernel by adding `arm_64bit=0` to config.txt.

See https://forums.raspberrypi.com/viewtopic.php?p=2088935#p2088935 for more details.

And also some comments

A 64-bit OS requires a 64-bit kernel.
A 32-bit OS can use a 32-bit or 64-bit kernel.

So add line “arm_64bit=0” at the end of /boot/config.txt in section pi4

[pi4]
# Run as fast as firmware / board allows
arm_boost=1
arm_64bit=0

[all]

And reboot.
Reinstallation of PlatformIO will work fine after.