Search Unity

Build Error when using il2cpp for Android

Discussion in 'Android' started by Vak_HD, May 18, 2019.

  1. Vak_HD

    Vak_HD

    Joined:
    Aug 6, 2016
    Posts:
    14
    Hi,
    I have encountered a problem when building my app using IL2CPP on Android. When the message on top of the progress bar says that it's Building native binary with IL2CPP... then it crashes and prints this:
    Failed running C:\Program Files\Unity\Hub\Editor\2019.1.3f1\Editor\Data\il2cpp/build/il2cpp.exe --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot" --compile-cpp --libil2cpp-static --platform="Android" --architecture="ARMv7" --configuration="Release" --outputpath="C:\Users\novak\Desktop\Days End\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a\libil2cpp.so" --cachedirectory="C:\Users\novak\Desktop\Days End\Assets\..\Library\il2cpp_android_armeabi-v7a/il2cpp_cache" --additional-include-directories="C:\Program Files\Unity\Hub\Editor\2019.1.3f1\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\bdwgc/include" --additional-include-directories="C:\Program Files\Unity\Hub\Editor\2019.1.3f1\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\libil2cpp/include" --tool-chain-path="C:/Program Files/Unity/Hub/Editor/2019.1.3f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK" --profiler-report --map-file-parser="C:/Program Files/Unity/Hub/Editor/2019.1.3f1/Editor/Data/Tools/MapFileParser/MapFileParser.exe" --directory="C:/Users/novak/Desktop/Days End/Temp/StagingArea/assets/bin/Data/Managed" --generatedcppdir="C:/Users/novak/Desktop/Days End/Temp/StagingArea/Il2Cpp/il2cppOutput"

    stdout:

    Building libil2cpp.so with AndroidToolChain

    Output directory: C:\Users\novak\Desktop\Days End\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a

    Cache directory: C:\Users\novak\Desktop\Days End\Library\il2cpp_android_armeabi-v7a\il2cpp_cache

    il2cpp.exe didn't catch exception: System.AggregateException: One or more errors occurred. ---> System.ComponentModel.Win32Exception: The system cannot find the file specified

    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

    at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)

    at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)

    at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)

    --- End of inner exception stack trace ---

    at Unity.IL2CPP.Building.ParallelFor.RunWithResult[D,T](D[] data, Func`2 action)

    at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable`1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector)

    at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)

    at il2cpp.Program.DoRun(String[] args)

    at il2cpp.Program.Run(String[] args)

    at il2cpp.Program.Main(String[] args)

    ---> (Inner Exception #0) System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

    at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)

    at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)

    at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---



    ---> (Inner Exception #1) System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

    at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)

    at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)

    at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---



    ---> (Inner Exception #2) System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

    at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)

    at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)

    at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---



    ---> (Inner Exception #3) System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

    at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)

    at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)

    at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---



    ---> (Inner Exception #4) System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

    at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)

    at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)

    at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---



    ---> (Inner Exception #5) System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

    at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)

    at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)

    at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---



    ---> (Inner Exception #6) System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

    at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)

    at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)

    at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---



    ---> (Inner Exception #7) System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

    at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)

    at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)

    at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---



    ---> (Inner Exception #8) System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

    at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)

    at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)

    at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---



    ---> (Inner Exception #9) System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

    at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)

    at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)

    at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---



    ---> (Inner Exception #10) System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

    at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)

    at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)

    at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---



    ---> (Inner Exception #11) System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

    at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)

    at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)

    at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)<---



    stderr:



    Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.ComponentModel.Win32Exception: The system cannot find the file specified

    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

    at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller)

    at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data)

    at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o)

    --- End of inner exception stack trace ---

    at Unity.IL2CPP.Building.ParallelFor.RunWithResult[D,T](D[] data, Func`2 action)

    at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable`1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector)

    at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)

    at il2cpp.Program.DoRun(String[] args)

    at il2cpp.Program.Run(String[] args)

    at il2cpp.Program.Main(String[] args)


    UnityEngine.Debug:LogError(Object)
    UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:128)
    UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action`1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:73)
    UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List`1, Action`1, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:496)
    UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(String, String, String, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:477)
    UnityEditorInternal.IL2CPPBuilder:Run() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:334)
    UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:63)
    UnityEngine.GUIUtilityProcessEvent(Int32, IntPtr)

    Exception: C:\Program Files\Unity\Hub\Editor\2019.1.3f1\Editor\Data\il2cpp/build/il2cpp.exe did not run properly!
    UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:130)
    UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:73)
    UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List`1[T] arguments, System.Action`1[T] setupStartInfo, System.String workingDirectory) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:496)
    UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (System.String inputDirectory, System.String outputDirectory, System.String workingDirectory, System.Boolean platformSupportsManagedDebugging) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:477)
    UnityEditorInternal.IL2CPPBuilder.Run () (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:334)
    UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:63)
    UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <563f4bbc342a4b6b88ae70c46cea610c>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <563f4bbc342a4b6b88ae70c46cea610c>:0)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <563f4bbc342a4b6b88ae70c46cea610c>:0)
    UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <563f4bbc342a4b6b88ae70c46cea610c>:0)
    UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:281)
    UnityEngine.GUIUtilityProcessEvent(Int32, IntPtr)

    I am using Unity 2019.1.3f1. Thanks.

     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    This error seems to indicate that the Android NDK is not installed or found properly. In the Unity editor preferences, please check the path to the Android NDK and ensure that none of the NDK directories have been removed.
     
  3. Vak_HD

    Vak_HD

    Joined:
    Aug 6, 2016
    Posts:
    14
    Thanks for the response and fortunately that was the cause of the error (the NDK for some reason wasn't installed properly).
     
    JoshPeterson likes this.
  4. Conferno

    Conferno

    Joined:
    Feb 27, 2014
    Posts:
    49
    And so, how you did fix the problem?
    Reinstall unity android pack with sdk ndk included? Has installed an android studio or ....?
    Or what...? I have the same issue and tired fight with it a 3rd day
     
  5. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    You should not need to reinstall anything from Unity. The Android NDK should be installed again, either via Android Studio or give direct download for the NDK from Google.
     
  6. Conferno

    Conferno

    Joined:
    Feb 27, 2014
    Posts:
    49
    - OK, so, I've downloaded NDK from here https://developer.android.com/ndk/downloads - for windows x64
    - Have unpacked it to MyDocuments
    - In Unity 2019.1.4f1, in settings, in NDK path I uncheck "Use recommended" and type the full path to it.
    - Click build
    - Same error
    What I am doing wrong ?
     
  7. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Can you provide the specific error message you see?
     
  8. Conferno

    Conferno

    Joined:
    Feb 27, 2014
    Posts:
    49
    So, it seems the Unity android NDK from installator is corrupted.
    After renaming an NDK folder from Android Player and click Build, Unity asks me to choose the path to NDK, I have chosen the new downloaded one, and it built the project. It is strange, but when I want to specify a custom folder by myself, it doesn't do anything. No popped up dialog.