This is a PX4 Firmware bug as mentioned here and here. The python package ‘empy’ used by WSL must be downgraded to version 3.3.4. You can follow the below instructions.
- Launch WSL where PX4 is cloned.
- Run the below commands in WSL.
pip uninstall em
pip uninstall empy
pip install empy==3.3.4
Launch the PX4 Hardware setup screen and try building the firmware now.