Unity freezes during build process

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!

I found this at the end of the Editor.log file…

…no actual error message, as far as I can see.

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.

The first time I gave it a few hours. Now I force kill it after about 10-15mins.

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:

I’ve installed Unity 2019.2.21f1 – so, a very minor upgrade and a fresh install – and now see this error response when building:

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.

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 (Process Explorer - Sysinternals | Microsoft Learn) 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.

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:

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:

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.

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!

3 Likes

Same Problem , Please Unity Guys Do Something because this is really a big problem

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.

Can you use Process Explorer, as mentioned above, to understand more details about what is happening when this freeze occurs?