Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Which process spawn clang when making a IL2CPP build?

Discussion in '2018.2 Beta' started by bitinn, Jun 3, 2018.

  1. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    812
    Hi all,

    I ran into a situation where:

    - In an one-off event, Unity IL2CPP standalone build appeared to be stuck, it rans for 20 minutes at full CPU without progressing (which wasn't the case for my previous builds)

    - I wasn't able to stop the build using UI, and had to resort to terminating Unity Editor.

    - But clang process persisted and kept respawning after Unity has stopped.

    - I fiddled for a bit and managed to stop all of them, but didn't quite understand which process is spawning clang in the first place.

    So I am wondering, just in case I ever ran into the same issue:

    - Which process is in charge of IL2CPP build, is it dotnet?

    - Any steps to troubleshoot long build time? How long is too long?

    PS: I am on Macbook Pro 2015 + macOS, my setup have met these recommendation.
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    5,507
    Yes. On newer versions of macOS, IL2CPP (which is a managed, C# executable) runs with .NET Core. The "dotnet" executable is the native executable that runs .NET Core applications.

    There is probably one generated C++ file that is taking a long time to compile. I would recommend letting the compilation run for a bit, then see if there is still just one clang process left. If so, try to get the command line for that process. The generated C++ source file path will be on that command line, and we can inspect that generated file to see why it is taking so long.

    In my experience, long compilation times usually occur when the code has many (10,000+) local variables in a single method. This can sometime happen with big data tables in C# code.

    If you can track down the generated source file causing the issue, I'll be happy to have a look at it.
     
    bitinn likes this.
  3. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    812
    Thx for the detailed explanation, I will have to reproduce it again, no promise :)

    I assume `ps ax` result should be good enough, if not, please do let me know what else you might use on macOS.
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    5,507
    I like htop, which has a macOS port. (I installed it with homebrew). This utility let's you view a process tree, so it is easier to see which child process is hanging.
     
    bitinn likes this.
unityunity