Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    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:
    961
    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:
    6,920
    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:
    961
    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:
    6,920
    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.