Export template compilation fails when compiling with link-time optimization

Godot Version

v4.2.1.stable.mono.custom_build [b09f793f5]


I’m trying to build an export template for my game with 3D and debug symbols disabled, but compilations fails every time I try to compile with link-time optimization enabled. I didn’t see a recent issue posted on GitHub for this, and the last time someone reported it was back in a much older version as far as I can tell.

Steps to reproduce:
-Clone the Git repo of godot
-Detach head for the 4.2.1-stable tag
-(Optional for me, the result is the same with or without this) Set an encryption key in the environment to use
-Run the following command:
scons platform=windows use_mingw=yes arch=x86_64 target=template_release use_llvm=true mingw64_prefix=x86_64-w64-mingw32- module_mono_enabled=yes disable_3d=yes debug_symbols=no lto=full

The build will compile successfully if I remove ‘lto=full’ but that’s one of the biggest reasons I wanted to build the export template myself. Is this a known issue or I’m doing something wrong?

PS: I have 32 GBs of RAM, and at the time of building the binaries, I had 24 GB free.

Sorry to bump this but is there a solution or it’s an issue with the source code atm?