godot icon indicating copy to clipboard operation
godot copied to clipboard

Compilation Failing on Windows

Open Swarkin opened this issue 1 year ago • 2 comments

Tested versions

master f032af74536b317b23c7fca3bc7318ced5537344

System information

Windows 11 - Intel i5 9600k

Issue description

Compilation randomy fails after a while:

[...}
Compiling scene\gui\box_container.cpp ...
Compiling scene\gui\button.cpp ...
Compiling scene\gui\center_container.cpp ...
Compiling scene\gui\check_box.cpp ...
editor\editor.windows.editor.x86_64.lib : fatal error LNK1248: image size (100764120) exceeds maximum allowable size (FFFFFFFF)
Compiling scene\gui\check_button.cpp ...
Compiling scene\gui\code_edit.cpp ...
Compiling scene\gui\color_mode.cpp ...
Compiling scene\gui\color_picker.cpp ...
Compiling scene\gui\color_rect.cpp ...
Compiling scene\gui\container.cpp ...
scons: *** [editor\editor.windows.editor.x86_64.lib] Error 1248
scons: building terminated because of errors.
[Time elapsed: 00:08:12.40]

Steps to reproduce

clone godot scons p=windows arch=x86_64 production=yes lto=full target=editor optimize=speed deprecated=no

Minimal reproduction project (MRP)

Swarkin avatar Oct 04 '24 14:10 Swarkin

Bisecting points to #93311 as the culprit, @dsnopek

image

matheusmdx avatar Oct 04 '24 21:10 matheusmdx

It is the lto=full causing the Error 1248. Builds fine with other build options that dont use lto.

smix8 avatar Oct 06 '24 15:10 smix8

Still relevant

Swarkin avatar Oct 26 '24 09:10 Swarkin

Does the problem occur when using clang-cl.exe instead of cl.exe? It can be installed through the visual studio install tool

hpvb avatar Jan 08 '25 20:01 hpvb

Sorry for not taking a look at this sooner!

I am able to reproduce locally with scons p=windows lto=full on current master.

However, even if I try completely reverting PR #93311 (so, current master but with those changes reverted, plus removing some other new usages of GDVIRTUAL*_REQUIRED()), I still get the same LNK1248 error.

So, I think my PR was more "the straw that broke the camels back", rather a problematic change, since it seems that other changes after my PR will cause the same issue.

dsnopek avatar Jan 08 '25 22:01 dsnopek

This is a limitation of COFF format. See https://developercommunity.visualstudio.com/t/static-lib-4gb-file-size-limit-lnk1248-image-size/332991

COFF has a 4GB size limit - offset fields in COFF won’t be able to encode anything larger than 4GB due to fields being 4-byte wide.

The only way to workaround this seems to be split the lib file.

Strange though without LTO this lib is only 239MB.

Checking other lib files, LTO bloat file size by a factor of 5-10x. text_server_adv: 10MB -> 46MB webrtc: 2MB -> 23MB

clang-cl doesn't have this issue, use_llvm=yes use_lto=full produce libs even smaller than msvc without lto.

YYF233333 avatar Jan 16 '25 09:01 YYF233333

How did you get the FFFFFFFF size? I am on Windows 10 and vs 2019 and it also exceeds the limit, but the limit is only 80000000

swgu98 avatar May 27 '25 08:05 swgu98

No idea; I haven't done any special configuration at all, I just followed the docs with installing the build tools. I also haven't attempted to compile Godot in a while, so I cannot tell you whether it is still relevant.

Swarkin avatar May 27 '25 09:05 Swarkin

Today I tried LTO build with MSVC and successfully built it with scons production=yes debug_symbols=yes scu_build=yes lto=full. Either our build system has some updates, or SCU helps reduce the size of the library. Hope this information is helpful.

YYF233333 avatar Jul 01 '25 20:07 YYF233333

It still does not work for me.

bin\obj\editor\editor.windows.editor.x86_64.lib : fatal error LNK1248: image size (100962D3A) exceeds maximum allowable size (FFFFFFFF)

scons: *** [bin\obj\editor\editor.windows.editor.x86_64.lib] Error 1248

Swarkin avatar Jul 02 '25 12:07 Swarkin

Steps to reproduce

git clone https://github.com/godotengine/godot --depth 1
cd godot
scons p=windows arch=x86_64 production=yes lto=full target=editor optimize=speed deprecated=no

Swarkin avatar Jul 02 '25 12:07 Swarkin