Search Unity

Discussion Unity app upgraded from 2018.4.X to 2021.3.X seems impossible to build with IL2CPP for Android

Discussion in 'Editor & General Support' started by exsurgo_ankit, Dec 19, 2022.

  1. exsurgo_ankit

    exsurgo_ankit

    Joined:
    Feb 5, 2020
    Posts:
    29
    Hello,

    We have been trying to build our app before committing to upgrading to unity's latest LTS. It has been a mission. We upgraded the project to 2019 first and resolved asset import issues. Then we updated to 2021.3.14/15/16 all while attempting to do a build.
    As you know that in order to publish on google app store we have to build using IL2CPP, it seems we will never be able to upgrade our project to recent unity versions using the Bee backend.

    We have had numerous issues starting with postgres's npgsql that we have managed to compile by bringing is various nuget dll dependencies.
    Now we notice the Unity spawning 40+ threads of clang++.exe in the background and consuming 100% CPU for hours.

    Yes there is an antivirus (ESET) running in the background that may be slowing it down but we have waited for hours on the end.

    I have a parallel project running on 2018.4.36f1 on the same computer which complete the IL2CPP build in less than 10 minutes.

    What has changed in terms of IL2CPP build in 2021 and why can't the methods used in 2018 work anymore? Is it advisable to upgrade to 2021 with these issues in building for the play store?

    Update: I have followed instructions from the following links and forum threads
    1. https://docs.unity3d.com/Manual/IL2CPP.html
    2. https://forum.unity.com/threads/android-il2cpp-build-is-too-slow-compared-to-ios.731672/
    3. https://forum.unity.com/threads/im-...elopment-but-not-script-debugging-on.1187170/

    Also tried increasing managed stripping level as per the link below as the build would fail with script debugging enabled even with "Faster (smaller) builds" option. I understand that it is java NDK issue.
    https://docs.unity3d.com/Manual/ManagedCodeStripping.html



    Ankit
     
    Last edited: Dec 19, 2022
    Sheyk2022 likes this.
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    This is definitely not a behavior we expect. In general, the compile time performance of IL2CPP builds has gotten better with each Unity release since 2018, so there most be something special happening here.

    There are some log files that might help us understand the cause of the problem. Can you look for a file named profile.json in the Unity project directory after the builds for the project with Unity 2018 and Unity 2021? If possible, can you send those to me via private message? They should have build tracing information that might help us understand where the time is going.
     
  3. exsurgo_ankit

    exsurgo_ankit

    Joined:
    Feb 5, 2020
    Posts:
    29
    Hello Josh,

    Thank you for responding to this thread.

    I cannot find profile.json in Unity 2018 project folder. Is it called something else in Unity 2018?

    From one of your previous responses it seems that this is an undocumented feature. I referred to the following links but the instructions are not clear to me. If a script is created then where exactly should it be placed?

    I also noted that profile.json is requested in many threads. It would be very helpful if there were clear and precise instructions to enable this file generation.

    1. https://answers.unity.com/questions...-inv.html?childToView=1611754#comment-1611754

    2. https://support.unity.com/hc/en-us/...environment-variable-s-set-how-can-I-do-that-

    3. https://github.com/akauper/Addressables-AssetManager/issues/3


    Regards
    Ankit
     
    Last edited: Jan 10, 2023
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Yes, this is a common request, and one that we should better support. For this specific case, I'm trying to track down where this file lived (or if it was even generated) in Unity 2018.

    Do you have the file from Unity 2021 though? With that we might be able to track down the cause.
     
  5. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    @exsurgo_ankit: It looks like you can pass two additional IL2CPP command line arguments to cause this report to the generated in Unity 2018: --enable-stats --profiler-report

    If you run the Unity editor with the following environment variable set, these options will be passed to IL2CPP:

    IL2CPP_ADDITIONAL_ARGS = "--enable-stats --profiler-report"

    Please try that, then run the build again. That should cause the profile.json to be generated.
     
  6. exsurgo_ankit

    exsurgo_ankit

    Joined:
    Feb 5, 2020
    Posts:
    29
    @JoshPeterson
    Thank you for the above instructions. I have messaged the profile for 2018 to you via a private message.
    Unity 2021 build has stopped working and it was unreliable to begin with. Once I manage to build with 2021, I will follow up with another profile.json
     
  7. exsurgo_ankit

    exsurgo_ankit

    Joined:
    Feb 5, 2020
    Posts:
    29
    @JoshPeterson
    The buildreport.json from Unity 2021 has been sent you to via a private message.
    For others benefit, the build profile has been renamed to buildreport.json.
    It can be found in /Library/Bee folder.