Problem when building for IOS

Hello, my team and I have been having some problems regarding the compilation of our project, but we are not quite sure what is wrong. Can someone help us? It happens when trying to build for ios out AR app.

This only tells us that the build failed. The actual error messages are listed earlier. Even better if you attach the editor.log after making a failed build.

1 Like
Exception: Failed running /Applications/Unity/Hub/Editor/2021.3.13f1/Unity.app/Contents/il2cpp/build/deploy/UnityLinker @"/Users/abrahamch/Desktop/Andromeda/Temp/StagingArea/Data/Managed/response.rsp"

stdout:
Fatal error in Unity CIL Linker
Mono.Linker.LinkerFatalErrorException: ILLink: error IL1011: Failed to write '/Users/abrahamch/Desktop/Andromeda/Temp/StagingArea/Data/Managed/tempStrip/FSharp.Core.dll
---> System.NullReferenceException: Object reference not set to an instance of an object.
at Mono.Cecil.MetadataBuilder.AddLocalConstants(ScopeDebugInformation scope)
at Mono.Cecil.MetadataBuilder.AddLocalScope(MethodDebugInformation method_info, ScopeDebugInformation scope)
at Mono.Cecil.MetadataBuilder.AddMethodDebugInformation(MethodDebugInformation method_info)
at Mono.Cecil.Cil.CodeWriter.WriteResolvedMethodBody(MethodDefinition method)
at Mono.Cecil.Cil.CodeWriter.WriteMethodBody(MethodDefinition method)
at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)
at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)
at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
at Mono.Cecil.MetadataBuilder.AddTypes()
at Mono.Cecil.MetadataBuilder.BuildTypes()
at Mono.Cecil.MetadataBuilder.BuildModule()
at Mono.Cecil.MetadataBuilder.BuildMetadata()
at Mono.Cecil.ModuleWriter.<>c.<BuildMetadata>b__2_0(MetadataBuilder builder, MetadataReader _)
at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata)
at Mono.Cecil.ModuleWriter.Write(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
at Mono.Cecil.ModuleWriter.WriteModule(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory, WriterParameters writerParameters) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/OutputStep.cs:line 127
--- End of inner exception stack trace ---
at Mono.Linker.Steps.OutputStep.WriteAssembly(AssemblyDefinition assembly, String directory, WriterParameters writerParameters) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/OutputStep.cs:line 129
at Unity.Linker.Steps.UnityOutputStep.WriteAssembly(AssemblyDefinition assembly, String directory, WriterParameters writerParameters) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker.Steps/UnityOutputStep.cs:line 48
at Mono.Linker.Steps.OutputStep.OutputAssembly(AssemblyDefinition assembly) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/OutputStep.cs:line 146
at Mono.Linker.Steps.BaseStep.Process(LinkContext context) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/BaseStep.cs:line 63
at Unity.Linker.UnityPipeline.ProcessStep(LinkContext context, IStep step) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker/UnityPipeline.cs:line 23
at Mono.Linker.Pipeline.Process(LinkContext context) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker/Pipeline.cs:line 128
at Unity.Linker.UnityDriver.UnityRun(Boolean noProfilerAllowed, ILogger customLogger) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker/UnityDriver.cs:line 125
at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling(ILogger customLogger, Boolean noProfilerAllowed) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker/UnityDriver.cs:line 81
at Unity.Linker.UnityDriver.RunDriver() in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker/UnityDriver.cs:line 62
stderr:

UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildUtils.cs:133)
UnityEditorInternal.Runner.RunNetCoreProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildUtils.cs:91)
UnityEditorInternal.AssemblyStripper.RunAssemblyLinker (System.Collections.Generic.IEnumerable`1[T] args, System.String& out, System.String& err, System.String linkerPath, System.String workingDirectory) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/AssemblyStripper.cs:156)
UnityEditorInternal.AssemblyStripper.StripAssembliesTo (System.String outputFolder, System.String& output, System.String& error, System.Collections.Generic.IEnumerable`1[T] linkXmlFiles, UnityEditorInternal.UnityLinkerRunInformation runInformation) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/AssemblyStripper.cs:147)
UnityEditorInternal.AssemblyStripper.RunAssemblyStripper (UnityEditorInternal.UnityLinkerRunInformation runInformation) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/AssemblyStripper.cs:233)
UnityEditorInternal.AssemblyStripper.StripAssemblies (System.String managedAssemblyFolderPath, UnityEditorInternal.BaseUnityLinkerPlatformProvider unityLinkerPlatformProvider, UnityEditorInternal.IIl2CppPlatformProvider il2cppPlatformProvider, UnityEditor.RuntimeClassRegistry rcr, UnityEditor.ManagedStrippingLevel managedStrippingLevel) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/AssemblyStripper.cs:168)
UnityEditorInternal.IL2CPPBuilder.Run () (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:617)
UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:279)
UnityEditor.iOS.PostProcessiPhonePlayer.CrossCompileManagedDlls (UnityEditor.iOS.PostProcessiPhonePlayer+BuildSettings bs, UnityEditor.iOS.PostProcessiPhonePlayer+ProjectPaths paths, UnityEditor.AssemblyReferenceChecker checker, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport buildReport) (at /Users/bokken/build/output/unity/unity/PlatformDependent/iPhonePlayer/Extensions/Common/BuildPostProcessor.cs:932)
UnityEditor.iOS.PostProcessiPhonePlayer.PostProcess (UnityEditor.iOS.PostProcessiPhonePlayer+BuildSettings bs, UnityEditor.iOS.PostProcessiPhonePlayer+ProjectPaths paths, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport buildReport) (at /Users/bokken/build/output/unity/unity/PlatformDependent/iPhonePlayer/Extensions/Common/BuildPostProcessor.cs:755)
UnityEditor.iOS.PostProcessiPhonePlayer.PostProcess (UnityEditor.iOS.PostProcessorSettings postProcessorSettings, UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/build/output/unity/unity/PlatformDependent/iPhonePlayer/Extensions/Common/BuildPostProcessor.cs:695)
UnityEditor.iOS.iOSBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/build/output/unity/unity/PlatformDependent/iPhonePlayer/Extensions/Common/ExtensionModule.cs:45)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
UnityEditor.iOS.iOSBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/build/output/unity/unity/PlatformDependent/iPhonePlayer/Extensions/Common/ExtensionModule.cs:49)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at /Users/bokken/build/output/unity/unity/Editor/Mono/Modules/DefaultBuildPostprocessor.cs:28)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, 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 /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:370)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)

I am trying to build for IOS. I am using NuGet for some features and I am not sure if that is casing the problem. We just started learning Unity and we are not really sure how we are doing.

How to troubleshoot build failures:

First, make a blank project with a single blank scene and prove that it builds successfully.

If the blank project does NOT build, go fix your Unity installation or your other tools, such as Android SDK, NDK, JDK, etc. It may even be necessary to change to a different version of Unity3D. It is generally best to stay with LTS versions of Unity3D.

Until you can build a blank project to the target platform, don’t fiddle with anything else.

Once you can build a blank project, now bisect the problem by bringing over parts of your current project and building it one subsystem at a time, perhaps stubbing things out that might trigger compiler errors.

Most often things that prevent building are third-party libraries such as Firebase.

Once you identify the subsystem, go to the documentation for it and make sure you are doing it correctly.

It may also be helpful to work through a tutorial or two for whatever subsystem is making the build fail.

Android build not building:

Recently (circa July 2022) there have been reports of Unity’s installer failing to install the Android Tools.

Here was how I brought up Unity2020.3.41 and the Android SDK 31 on October 30, 2022:

Android Gradle errors and other related stuff:

1 Like

@Kurt-Dekker Provides some great troubleshooting setups (thanks!).

In addition, I’ll ask this: Are you attempting to use F# code in your project? It looks like the error happens due to an F# assembly. Unity does not support F#, so I would avoid using it if you can.

1 Like

You were right. The thing is that on my game (which is a physics game for students) there is a section in which I need to evaluate two equations and determine if they are equivalent. I found this was possible through a C# library that I installed through Nuget. After I removed those packages it compiled well on IOS. Do you happen to know a way in which I can evaluate the equivalency of two equations given as strings, maybe by simplifying the expressions?

Thank you so much any way for the responses

I don’t know of a library like that off the top of my head. In general though, a library build with C# that targets .NET Standard 2.1 should work with Unity. So if you can find something like that, it might solve your problem.