Search Unity

Unity freezes during build process

Discussion in 'Editor & General Support' started by Barliesque, May 5, 2020.

  1. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    I'm working with Unity 2019.2.20f1 on a Windows Standalone project for VR. When I try to make a build, Unity freezes during the phase: "Building native binary with IL2CPP..."

    Please help!
     
  2. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    I found this at the end of the Editor.log file...

    ...no actual error message, as far as I can see.
     
  3. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,909
    The IL2CPP can take quite some time. Are you force killing Unity? How long was it staying frozen? Maybe just give it more time. I have a relatively small project and it takes ~3-4 minutes on my macbook.
     
  4. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    The first time I gave it a few hours. Now I force kill it after about 10-15mins.
     
  5. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    Okay, after restarting the computer and clearing out temp files, I've got the build to at least fail with errors, rather than freezing Unity. Here's what I found in the Editor.log file:

     
  6. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    I've installed Unity 2019.2.21f1 -- so, a very minor upgrade and a fresh install -- and now see this error response when building:
     
  7. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    I've also explored the possibility anti-virus software was the culprit; I added exclusions for the project folder, and disabled all anti-virus software. Still the problem persists.
     
  8. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    I suspect that there is one C++ file that gets stuck and takes a long time to build. Are you at a point where you can reproduce the original issue?

    If so, try to use Process Explorer (https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer) with its tree view to see which cl.exe (C++ compiler) process is still running as a child of il2cpp.exe. The command line for this process will tell us which C++ file it is compiling, and that might help us track down the cause of the problem.
     
  9. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    Hi Josh. Firstly, thanks for your reply!

    While attempting to do an IL2CPP build, I ran Process Explorer. Once it's properly stuck, the process under il2cpp.exe is cl.exe, with the following command line:

     
  10. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    The above command line came from a copy of the project using Unity 2019.3.10f1

    Building with Unity 2019.2.21f1, the same process gets stuck with the following command line:
     
  11. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    Thanks! It looks like file in both cases is InteractionEngineUtility.cpp. That seems to be the place to investigate. Often the C++ compiler will struggle with a function that is very large, with many (i.e. thousands) of local variables. Do you know if there are any functions like this in this file?

    Also, it might be worth trying a debug build (using the C++ Compiler Configuration option in the Player Settings). If the debug build is much faster than a release build, that might indicate that the C++ compiler is struggling with a function or two in this file.
     
  12. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    So, that file is part of the Interaction Engine module of Leap Motion's SDK. Fortunately, I'm not actually using it. Maybe it was out of date? I dunno, but removing it entirely has resolved the problem and allowed the IL2CPP build to complete successfully. At last!!! Thank you so much for your help!
     
  13. ISTA33

    ISTA33

    Joined:
    Apr 2, 2020
    Posts:
    8
    Same Problem , Please Unity Guys Do Something because this is really a big problem
     
  14. ISTA33

    ISTA33

    Joined:
    Apr 2, 2020
    Posts:
    8
    Look it freezes here sometime in the build Player Data , and then it work one time i don't know why than it wont work again , unity 2022 is really perfect to be honest the design the options but please give us a simple solution for this problem.
     

    Attached Files:

  15. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    Can you use Process Explorer, as mentioned above, to understand more details about what is happening when this freeze occurs?