IL2CPP freeze while exporting android project in unity 2017.4.2 . Stuck on "Building native binary with IL2CPP"
Hi, I am trying to export an android project using Gradle build system. But the process is stuck at '"Building native binary with IL2CPP.' After a while the memory runs out(on a system with 16GB RAM). I don't see any helpful error messages in the editor. Can anyone please help me out?
In the activity monitor I can see two clang++ process. One of them consuming almost all of my memory.
PS: I tried to export android project of the same unity project on 5.5.2 and 5.6 and they both work. In those ndk-r10e is used where as on unity 2017.4.2f2 ndk-r13b is used.
Attached is the editor log.link text
Answer by JoshPeterson · May 21, 2018 at 12:34 PM
This looks like a crash in the clang C++ compiler from the Android NDK, unfortunately. Our best option is to try to work around the crash by changing the C# code that is generating the C++ code which clang cannot handle.
You might want to have a look at the /var/folders/j5/nc34t7qs7qx4bw68ktmxbyn80000gn/T/Bulk_Assembly-CSharp-firstpass_2-2c9a71.cpp file, which is the one clang crashed while compiling.
In my experience with these issues, often very large functions (with 10,000 or more local variables) can cause a problem like this. So, it is worth a look though the generated C++ code to see if you find a large function like that. If you do, you can try to break the associated C# method into smaller methods. That might help.
You are absolutely right! Had a look at the generated file and found that one of my plugins was generating a strangely large function. Removed the plugin and voila! Was able to export the project. :)
I know it's like 3 years late xD but do you know I can find this "var/folders/j5/nc34t7qs7qx4bw68ktmxbyn80000gn/T/Bulk_Assembly-CSharp-firstpass_2-2c9a71.cpp file" file? I can't find it inside the project folder, where is it created?
This specific file probably does not exist for your project. Since this post, the what IL2CPP names files has changed as well. You can look for any .cpp file named Assembly-CSharp* in the Unity project directory if you would like to see the generated C++ code for Assembly-CSharp.dll.
And how do you find these large functions in a 25000 line document without spending 3 days?
Your answer
Follow this Question
Related Questions
il2cpp.exe error pls help me and solve out my problem 1 Answer
Android building process gets stuck on "Building native binary with IL2CPP" 2 Answers
Can't Build with IL2CPP for Android after 2018.3.0 Update(Empty Project) 1 Answer
Problem with Unity 2018.4.24 on Big Sur 0 Answers
il2cpp.exe didn't catch exception: System.IO.IOException: Access to the path '{path}' is denied. 0 Answers