-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LTO for web builds failing: attempt to add bitcode file after LTO (htonl.o
)
#92371
Comments
I can confirm that the same build args work fine for non-web compilations. ( |
adding |
Does it happen for you without all the remaining options disabling various features? Or just with that specific set of options? Because I can't confirm, I can build just fine with lto Testing with the specific instructions and will see if it works on my end |
Can confirm with those options, will try pin down what specifically causes it tomorrow |
I've narrowed it down to |
htonl.o
)
See:
It's not the first time we need to workaround Emscripten LTO bugs where it doesn't include a symbol when linking which is actually needed by the code LLVM is emitting.
BTW @Swarkin I see you commented there already, this kind of information is important to bring up in a downstream Godot bug report so that our issue triagers don't spend time redoing research that you already did. |
I saw a suggestion that one might be able to get most benefits from LTO by compiling the objects with So I tried that, which works. But the resulting binaries need to be benchmarked to see if there's any impact on performance (notably in the GDScript VM, which benefits a lot from it). On the size, for the minimal template built with the command from OP, disabling LTO actually keeps the binary smaller by over 600 KiB. With
All in all LTO might not really help with binary size on web. Last I checked ThinLTO was even worse. What we need to assess is how much it helps on performance. If it's not huge on Web (compared to other platforms like Linux and Windows where we tested performance increases in the GDScript VM of up to 20%), then it might actually be best to make web builds without LTO (and that should save a ton of build time, as Emscripten/LLVM LTO linking is super slow because single-threaded). |
|
I'm surprised ENet is also compiled in web builds, considering web browsers can't send or receive UDP packets (which is ENet's only transport layer). Disabling it on the web platform would help reduce the default binary size a bit. |
Tested versions
Current master [be56cab]
System information
Windows 10; Tested with emsdk 3.1.59 and 3.1.53
Issue description
I am encountering the following error when trying to compile with
lto=full
for wasm:full output.txt
Steps to reproduce
Clone Godot source
Set up web compilation requirements
Run:
Minimal reproduction project (MRP)
see above
The text was updated successfully, but these errors were encountered: