ive been trying to cross compile an export template without 3d (to reduce export size) for windows on my linux machine but it always fails at the linking stage if i enable lto and i literally cant find this error anywhere else online
i have managed to build the linux version just fine with lto before this

so the error message is absurdly long and it says undefined reference to every single engine class

command goes as follows:
scons p=windows optimize=size disable_3d=yes target=template_release use_static_cpp=yes debug_symbols=no lto=full LINKFLAGS=--verbose

error log: (actual errors start at line 1549)

debugprint.zip
37kB

things i have tried:
using mold linker
using lld linker
LINKFLAGS=--verbose (seemingly did not print anything of use but i included it anyway)
LINKFLAGS=-g (also did not print anything helpful)
compiling with a single thread (-j1)
installing an "unstable" mingw package
asking chatgpt
reading loads of forum posts and godot github issues to find a solution (have not found any solutions)

all of them have the same result and i cant find this issue anywhere else on the internet and ive been trying for several days so ive come here, i have 2-3 years in programming experience but its my first time compiling something so please be patient with me
should i just run a windows docker container at this point?

    kuligs2 i am running "Linux Mint 21.1 x86_64"

    System:
      Kernel: 6.5.0-35-generic x86_64 bits: 64 compiler: N/A Desktop: Cinnamon 5.6.8 tk: GTK 3.24.33
        wm: muffin vt: 7 dm: LightDM 1.30.0 Distro: Linux Mint 21.1 Vera base: Ubuntu 22.04 jammy
    Machine:
      Type: Laptop System: Acer product: Aspire VN7-792G v: V1.02 serial: <superuser required>
      Mobo: Acer model: Aspire VN7-792G v: V1.02 serial: <superuser required> UEFI: Insyde v: 1.02
        date: 09/25/2015
    Battery:
      ID-1: BAT0 charge: 39.1 Wh (100.0%) condition: 39.1/52.5 Wh (74.4%) volts: 12.5 min: 11.4
        model: LGC AC14A8L type: Li-ion serial: <filter> status: Not charging
    CPU:
      Info: quad core model: Intel Core i7-6700HQ bits: 64 type: MT MCP smt: enabled arch: Skylake-S
        rev: 3 cache: L1: 256 KiB L2: 1024 KiB L3: 6 MiB
      Speed (MHz): avg: 2985 high: 3000 min/max: 800/3500 cores: 1: 2971 2: 2988 3: 3000 4: 2981
        5: 2986 6: 2992 7: 2998 8: 2971 bogomips: 41599
      Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
    Graphics:
      Device-1: Intel HD Graphics 530 vendor: Acer Incorporated ALI driver: i915 v: kernel ports:
        active: eDP-1 empty: DP-1, DP-2, HDMI-A-1, HDMI-A-2 bus-ID: 00:02.0 chip-ID: 8086:191b
        class-ID: 0300
      Device-2: NVIDIA GM107M [GeForce GTX 960M] vendor: Acer Incorporated ALI driver: nvidia
        v: 535.171.04 pcie: speed: 2.5 GT/s lanes: 16 bus-ID: 01:00.0 chip-ID: 10de:139b class-ID: 0302
      Device-3: Chicony HD WebCam type: USB driver: uvcvideo bus-ID: 1-9:3 chip-ID: 04f2:b526
        class-ID: 0e02
      Display: x11 server: X.Org v: 1.21.1.4 driver: X: loaded: modesetting,nvidia
        unloaded: fbdev,nouveau,vesa gpu: i915 display-ID: :0 screens: 1
      Screen-1: 0 s-res: 1920x1080 s-dpi: 98 s-size: 499x280mm (19.6x11.0") s-diag: 572mm (22.5")
      Monitor-1: eDP-1 model: AU Optronics res: 1920x1080 hz: 60 dpi: 128
        size: 381x214mm (15.0x8.4") diag: 437mm (17.2") modes: 1920x1080
      OpenGL: renderer: Mesa Intel HD Graphics 530 (SKL GT2) v: 4.6 Mesa 23.2.1-1ubuntu3.1~22.04.2
        direct render: Yes
    Audio:
      Device-1: Intel 100 Series/C230 Series Family HD Audio vendor: Acer Incorporated ALI
        driver: snd_hda_intel v: kernel bus-ID: 00:1f.3 chip-ID: 8086:a170 class-ID: 0401
      Sound Server-1: ALSA v: k6.5.0-35-generic running: yes
      Sound Server-2: PulseAudio v: 15.99.1 running: yes
      Sound Server-3: PipeWire v: 0.3.48 running: yes
    Network:
      Device-1: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter vendor: Lite-On
        driver: ath10k_pci v: kernel pcie: speed: 2.5 GT/s lanes: 1 bus-ID: 07:00.0 chip-ID: 168c:003e
        class-ID: 0280
      IF: wlp7s0 state: down mac: <filter>
      Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Acer Incorporated ALI
        driver: r8169 v: kernel pcie: speed: 2.5 GT/s lanes: 1 port: 3000 bus-ID: 08:00.0
        chip-ID: 10ec:8168 class-ID: 0200
      IF: enp8s0 state: down mac: <filter>
      IF-ID-1: enxe2fa3929eeef state: unknown speed: -1 duplex: half mac: <filter>
    Bluetooth:
      Device-1: Lite-On type: USB driver: btusb v: 0.8 bus-ID: 1-7:2 chip-ID: 04ca:3016 class-ID: e001
      Report: hciconfig ID: hci0 rfk-id: 3 state: up address: <filter> bt-v: 2.1 lmp-v: 4.2
        sub-v: 25a hci-v: 4.2
    Drives:
      Local Storage: total: 1.03 TiB used: 74.04 GiB (7.0%)
      ID-1: /dev/sda vendor: Samsung model: MZNLF128HCHP-00000 size: 119.24 GiB speed: 6.0 Gb/s
        type: SSD serial: <filter> rev: 101Q scheme: GPT
      ID-2: /dev/sdb vendor: Western Digital model: WD10JPVX-22JC3T0 size: 931.51 GiB
        speed: 6.0 Gb/s type: HDD rpm: 5400 serial: <filter> rev: 1A01 scheme: GPT
    Partition:
      ID-1: / size: 116.32 GiB used: 60.76 GiB (52.2%) fs: ext4 dev: /dev/sda2
      ID-2: /boot/efi size: 511 MiB used: 6.1 MiB (1.2%) fs: vfat dev: /dev/sda1
    Swap:
      ID-1: swap-1 type: file size: 12 GiB used: 877.2 MiB (7.1%) priority: -2 file: /swapfile
    USB:
      Hub-1: 1-0:1 info: Hi-speed hub with single TT ports: 16 rev: 2.0 speed: 480 Mb/s
        chip-ID: 1d6b:0002 class-ID: 0900
      Device-1: 1-1:5 info: Logitech G402 Gaming Mouse type: Mouse,HID driver: hid-generic,usbhid
        interfaces: 2 rev: 2.0 speed: 12 Mb/s power: 300mA chip-ID: 046d:c07e class-ID: 0300
        serial: <filter>
      Device-2: 1-6:7 info: OnePlus (Shenzhen) type: CDC-Data driver: rndis_host interfaces: 2
        rev: 2.1 speed: 480 Mb/s power: 500mA chip-ID: 2a70:f00e class-ID: 0a00 serial: <filter>
      Device-3: 1-7:2 info: Lite-On type: Bluetooth driver: btusb interfaces: 2 rev: 2.0
        speed: 12 Mb/s power: 100mA chip-ID: 04ca:3016 class-ID: e001
      Device-4: 1-9:3 info: Chicony HD WebCam type: Video driver: uvcvideo interfaces: 2 rev: 2.0
        speed: 480 Mb/s power: 500mA chip-ID: 04f2:b526 class-ID: 0e02
      Device-5: 1-10:4 info: Realtek RTS5129 Card Reader Controller type: <vendor specific>
        driver: rtsx_usb,rtsx_usb_ms,rtsx_usb_sdmmc interfaces: 1 rev: 2.0 speed: 480 Mb/s power: 500mA
        chip-ID: 0bda:0129 class-ID: ff00 serial: <filter>
      Hub-2: 2-0:1 info: Super-speed hub ports: 8 rev: 3.0 speed: 5 Gb/s chip-ID: 1d6b:0003
        class-ID: 0900
    Sensors:
      System Temperatures: cpu: 68.0 C pch: 60.5 C mobo: 48.0 C
      Fan Speeds (RPM): N/A
    Repos:
      Packages: 2928 apt: 2907 flatpak: 21
      No active apt repos in: /etc/apt/sources.list
      Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list
        1: deb http: //packages.linuxmint.com vera main upstream import backport
        2: deb http: //archive.ubuntu.com/ubuntu jammy main restricted universe multiverse
        3: deb http: //archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse
        4: deb http: //archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse
        5: deb http: //security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
      Active apt repos in: /etc/apt/sources.list.d/signal-xenial.list
        1: deb [arch=amd64 signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg] https: //updates.signal.org/desktop/apt xenial main
    Info:
      Processes: 338 Uptime: 21h 57m wakeups: 47497 Memory: 7.65 GiB used: 4.89 GiB (63.9%)
      Init: systemd v: 249 runlevel: 5 Compilers: gcc: 11.4.0 alt: 11/12
      Client: Unknown python3.10 client inxi: 3.3.13