Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question WebGL build "linking build.js (wasm)" takes forever

Discussion in 'Editor & General Support' started by doodler345, Jul 28, 2022.

  1. frozepk

    frozepk

    Joined:
    Mar 29, 2020
    Posts:
    3
    having the same issue after updated my engine to 2023.1.1f1
     
  2. sandstedt

    sandstedt

    Joined:
    May 24, 2015
    Posts:
    64
    @JustBeanUnity Just tried it on a brand new computer (also Intel), and worked like a charm.

    While doing a headless build on my AMD gaming laptop, I was following the log, and it seems to get stuck in the bee_backend.exe step for a very long time. I'll attach the the end part of the log file below, where it was in a phase where nothing happend and I just kept waiting for it to be completed.

    The build time continues to fluctuate on my AMD gaming laptop. On this build it "just" took around 20min (compared to 3min consistently on my other computers). Sometimes it's 45min. (for production builds)

    Code (CSharp):
    1.  
    2. ***Player size statistics***
    3. Level 0 'Assets/Start/Start.unity' uses 1.5 MB compressed / 9.2 MB uncompressed.
    4. Total compressed size 1.5 MB. Total uncompressed size 9.2 MB.
    5. Starting: C:\Program Files\Unity\Hub\Editor\2022.3.0f1\Editor\Data\bee_backend.exe --dont-print-to-structured-log --ipc --dagfile="Library/Bee/Playereaf5b70a.dag" --profile="Library/Bee/backend1.traceevents" Player
    6. WorkingDir: C:/Users/jonas/Spel/ProjectName
    7. Starting: C:\Program Files\Unity\Hub\Editor\2022.3.0f1\Editor\Data\Tools\netcorerun\netcorerun.exe "C:\Program Files\Unity\Hub\Editor\2022.3.0f1\Editor\Data\PlaybackEngines\WebGLSupport\WebGLPlayerBuildProgram.exe" "C:/Program Files/Unity/Hub/Editor/2022.3.0f1/Editor/Data/PlaybackEngines/WebGLSupport/Bee;C:/Program Files/Unity/Hub/Editor/2022.3.0f1/Editor/Data/Tools/BuildPipeline" "Library/Bee/Playereaf5b70a.dag.json" "Library/Bee/Playereaf5b70a-inputdata.json" "Library\Bee\buildprogram0.traceevents"
    8. WorkingDir: C:/Users/jonas/Spel/ProjectName
    9. ExitCode: 4 Duration: 0s98ms
    10. DisplayProgressbar: Incremental Player Build
    11. ExitCode: 0 Duration: 1s908ms
    12. Starting: C:\Program Files\Unity\Hub\Editor\2022.3.0f1\Editor\Data\bee_backend.exe --dont-print-to-structured-log --ipc --dagfile="Library/Bee/Playereaf5b70a.dag" --dagfilejson="Library\Bee\Playereaf5b70a.dag.json" --profile="Library/Bee/backend2.traceevents" Player
    13. WorkingDir: C:/Users/jonas/Spel/ProjectName
    14. Starting: C:\Program Files\Unity\Hub\Editor\2022.3.0f1\Editor\Data\Tools\netcorerun\netcorerun.exe "C:\Program Files\Unity\Hub\Editor\2022.3.0f1\Editor\Data\PlaybackEngines\WebGLSupport\WebGLPlayerBuildProgram.exe" "C:/Program Files/Unity/Hub/Editor/2022.3.0f1/Editor/Data/PlaybackEngines/WebGLSupport/Bee;C:/Program Files/Unity/Hub/Editor/2022.3.0f1/Editor/Data/Tools/BuildPipeline" "Library/Bee/Playereaf5b70a.dag.json" "Library/Bee/Playereaf5b70a-inputdata.json" "Library\Bee\buildprogram1.traceevents"
    15. WorkingDir: C:/Users/jonas/Spel/ProjectName
    16. ExitCode: 4 Duration: 14s
    17. ExitCode: 0 Duration: 0s763ms
    18. Starting: C:\Program Files\Unity\Hub\Editor\2022.3.0f1\Editor\Data\bee_backend.exe --dont-print-to-structured-log --ipc --dagfile="Library/Bee/Playereaf5b70a.dag" --dagfilejson="Library\Bee\Playereaf5b70a.dag.json" --profile="Library/Bee/backend3.traceevents" Player
    19. WorkingDir: C:/Users/jonas/Spel/ProjectName
    After that phase (wish took 14min 55s according to the log)

    Code (CSharp):
    1. ExitCode: 0 Duration: 14m:55s
    2. [websockify wrapper] Start node and websockify.js
    3. Refreshing native plugins compatible for Editor in 21.31 ms, found 3 plugins.
    4. Preloading 0 native plugins for Editor in 0.00 ms.

    And then a build report after that (didn't wanna post the entire log here)
     
    KamilCSPS likes this.
  3. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    376
    @sandstedt , do you mind submitting a bug report with your findings to Unity and posting the link here for us to follow?

    Looks like you're the only one doing comparative testing & at worst, QA will give you a ticket# we can follow if it's a duplicate with an existing internal ticket.

    Thanks!
     
  4. se210

    se210

    Joined:
    Jan 19, 2016
    Posts:
    3
    I'm having the same issue on Unity 2022.3.2.f1 <Metal> version when building with the Code Optimization: Runtime Speed setting for a WebGL build.
     
  5. duckSPLASH

    duckSPLASH

    Joined:
    Jul 11, 2020
    Posts:
    14
    Not fixed as of 2022.3.4 :(
    I'll try the workaround.
     
  6. atomikm

    atomikm

    Joined:
    Feb 8, 2020
    Posts:
    20
    We're having the same issue on 2022.3.3f1

    WebGL build takes over an hour when it used to take a few minutes.
    Set to "Runtime Speed"
    Macbook Pro 2021
     
    Skyblade likes this.
  7. PcGameHunter

    PcGameHunter

    Joined:
    Sep 16, 2019
    Posts:
    3
    Not fixed or even acknowledged as known in 2022.3.5f1
     
    Skyblade and ughost123 like this.
  8. ughost123

    ughost123

    Joined:
    Feb 15, 2019
    Posts:
    2
    We're having the same issue on 2022.3.4f1
     
    Skyblade likes this.
  9. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    218
    Same problem here. Currently using 2022.2.15 and waiting for confirmation before upgrading to LTS.
    Our project's using Inputsystem and Addressables packages. Build timer over 1 hour were confirmed on a Threadripper 3970x, Intel 12700k and github actions build workflow using ubuntu. All systems having build times from 1 - 3 hours. Using "shorter build time" instead of "runtime speed" as code optimisation drops a hot build down to 2 minutes on the TR and 23 Minutes on the github action.
     
  10. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    218
    I noticed the "Linking" step utilizes two executables, wasm-ld.exe and wasm-opt.exe. In all Code Optimisation settings, the first one seems single-threaded while the second one is multithreaded.

    In "shorter build time", wasm-opt.exe starts after roundabout 2 minutes while in "runtime speed" this executable is still not active after 15 minutes, only wasm-lt.exe takes up 100% of one core.

    RuntimeSpeed.PNG ShorterBuildTime.PNG
     
    Last edited: Jul 19, 2023
  11. TomMcEachan

    TomMcEachan

    Joined:
    Oct 29, 2022
    Posts:
    1
    Can't believe this is still an issue. Experiencing this on a brand new empty project.
     
  12. rusyaka

    rusyaka

    Joined:
    Feb 10, 2020
    Posts:
    2
    Same problem in version 2022.3.5f1
     

    Attached Files:

    Last edited: Jul 20, 2023
    Skyblade and tantx like this.
  13. tantx

    tantx

    Joined:
    Jul 5, 2017
    Posts:
    19
    Set the [code optimization = Shorter Build Time] could handle the speed problem on project.
     
  14. dinkelstefan

    dinkelstefan

    Joined:
    Mar 13, 2019
    Posts:
    29
    Skyblade likes this.
  15. Qwerty526613

    Qwerty526613

    Joined:
    Nov 26, 2016
    Posts:
    1
    I have the same problem on Unity 2022.3.3f1c1, i changed some code use JetBrains Rider(2023.1.2). then i build WebGL program, the problem was happend. but when i close Rider the problem has gone。so i think when i bulid the scene rider is load some data in scene , it has locked scene. Unity is wait for rider.
     
  16. PcGameHunter

    PcGameHunter

    Joined:
    Sep 16, 2019
    Posts:
    3
    Continues to be an issue on 2022.3.6f1
     
  17. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    738
    Indeed says 2023.1.0b... and here i am 2023.1.8f and .. well its been >13 mins now.. it only makes a 44k build file, an how btw do you "link" a js file - its text interpreted later.. does this file even vary with project?

    Future liz was here: >25 mins to build 20+ mins were linking build.js
     
    Last edited: Aug 11, 2023
  18. arjuniscool0204

    arjuniscool0204

    Joined:
    May 16, 2017
    Posts:
    14
    @JustBeanUnity any update on the multi threading issue with the build modes?
     
  19. igamebank

    igamebank

    Joined:
    Jun 25, 2019
    Posts:
    1
    When I disable "Name Files as Hashes" it seems to compile very quickly (Unity 2023.2.0b4) . Anybody else, or is this a wild fluke?

    Update, it was a fluke. It worked once and hasn't since.
     
    Last edited: Aug 11, 2023
  20. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    738
    shame
     
  21. Epiroc_RS

    Epiroc_RS

    Joined:
    Jan 10, 2022
    Posts:
    3
    How is this not only not fixed yet, but basically ignored ???
     
  22. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    738
    ive got a site with a bunch of unity games on, compiled up a 2d one today stuck it on.. and yet again its not loading properly - Im getting sick of the way unitys web has to be "just so" or it falls in a heap of poop .. i dont want to have to recompile all the old projects in new unitys just to make sure all websettings are the same.. if itends in .gz its gziped it shouldnt need special settings
     
  23. AmmarByFar

    AmmarByFar

    Joined:
    Nov 20, 2019
    Posts:
    4
    I guess the question is, how much does the "Runtime Speed" actually help during runtime? Is there a noticeable framerate increase? Much faster loading times? Where does the performance in Runtime actually come in?

    If it's not too noticeable I guess, I'll just stick with "Shorter Build Speed" to keep things moving along.
     
  24. tkgix

    tkgix

    Joined:
    Nov 9, 2016
    Posts:
    5
    2022.3.3f1, the same problem is occurring.

    Why does Unity get worse with every update...?
     
  25. TomTheMan59

    TomTheMan59

    Joined:
    Mar 8, 2021
    Posts:
    302
    This has been explained numerous times, in this thread (on a different page) and other threads. Please read through the threads to see if there is a solution before replying the same thing everyone else is.

    Why the build is slow: https://forum.unity.com/threads/how...sm-time-be-accellerated.1427124/#post-9260838

    How to make build faster: https://forum.unity.com/threads/how...sm-time-be-accellerated.1427124/#post-9261150
     
  26. edassis

    edassis

    Joined:
    Jul 15, 2022
    Posts:
    4
    I recently migrate my project from 2021.3.8f to 2022.3.9f1 and build.js is taking forever to link:

    upload_2023-10-1_14-7-3.png
    This time passes 30 minutes.

    I removed Library/. Temp/, Obj/, Build/ and made a clean build.

    Time to rollback to 2021.* I guess.

    ---

    EDIT1: I just saw jukka_j's answer and I can confirm that changing Code Optimization to "Build Times" indeed made the build process much faster (< 7 min). "WebAssembly.Table" and "BigInt" language features is available from version 2023 onwards.
     
    Last edited: Oct 1, 2023
  27. Pawl

    Pawl

    Joined:
    Jun 23, 2013
    Posts:
    113
    +1 My build times for a small 2D game:

    Unity 2021.3.16f1 were ~3 minutes
    Unity 2022.3.10f1 are now ~12 minutes.

    Screenshot 2023-10-09 231135.png

    Shorter Build Time (as advertised, I guess) brought them down to ~4 minutes.
     
  28. vbl-public

    vbl-public

    Joined:
    Feb 16, 2022
    Posts:
    3
    Having this issue now, builds were taking ~10 minutes on 2021.3.10f1, now taking hours on 2022.3.10f1 (I don't have hours so I haven't been able to let one finish). This is insane that Unity shipped 2022.3 LTS in this condition!?
     
  29. unity_4129B0F0E28458052E80

    unity_4129B0F0E28458052E80

    Joined:
    Oct 16, 2023
    Posts:
    1
  30. jackcrosa

    jackcrosa

    Joined:
    Oct 16, 2012
    Posts:
    22
    My project also takes an hour to build this is very bad.
     
  31. Skaldhiir

    Skaldhiir

    Joined:
    Oct 21, 2013
    Posts:
    1
    Same issue with Unity 2023.1.15f1
     
  32. kenor_brooks

    kenor_brooks

    Joined:
    Jun 4, 2020
    Posts:
    45
    2022.3.12f1 same problem.
     
  33. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    376
    For everyone posting "same issue", it is per-design and Unity won't "fix it" per se.

    The compile options posted in this thread are exposed in 2023.x to make it easier to use. Otherwise, I hope Unity Mods can just close this thread as it is noise.