Not able to build an iOS build. UnusedBytecodeStripper2.exe did not run properly! (599113)

Hi, I am getting errors while building an iOS build when scripting backend is IL2CPP but it works fine when the scripting backend is Mono2x. This error occurs after I update unity to 5.2.1f1(Personal). I am using iMac and Unity 5.2.1f1(Personal).

You can download the project from this link : Dropbox

Please suggest me how to get rid of these errors.

Thanks.

Errors :

--------------Error 1----------------
Failed running /Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper2/UnusedBytecodeStripper2.exe -out “/Users/mohit/Desktop/we/Temp/StagingArea/Data/Managed/tempStrip” -l none -c link -x “/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper/native_link.xml” -f “/Applications/Unity/Unity.app/Contents/Frameworks/il2cpp/LinkerDescriptors” -x “/Users/mohit/Desktop/we/Temp/StagingArea/Data/Managed/../platform_native_link.xml” -x “/Users/mohit/Desktop/we/Temp/StagingArea/Data/methods_pointedto_by_uievents.xml” -d “/Users/mohit/Desktop/we/Temp/StagingArea/Data/Managed” -a “/Users/mohit/Desktop/we/Temp/StagingArea/Data/Managed/Assembly-CSharp-firstpass.dll” -a “/Users/mohit/Desktop/we/Temp/StagingArea/Data/Managed/Assembly-CSharp.dll” -a “/Users/mohit/Desktop/we/Temp/StagingArea/Data/Managed/Assembly-UnityScript.dll” -a “/Users/mohit/Desktop/we/Temp/StagingArea/Data/Managed/NGUI.dll”

stdout:
ERROR: Failed to resolve base type System.Security.Principal.GenericIdentity for type System.Net.HttpListenerBasicIdentity
Fatal error in Mono CIL Linker
System.Exception: ERROR: Failed to resolve base type System.Security.Principal.GenericIdentity for type System.Net.HttpListenerBasicIdentity
at UnusedBytecodeStripper2.ResolveFromMonoBehaviours.IsMonoBehaviourOrScriptableObject (Mono.Cecil.TypeDefinition type) [0x00000] in :0
at System.Linq.Enumerable+c__Iterator1E`1[Mono.Cecil.TypeDefinition].MoveNext () [0x00000] in :0
at UnusedBytecodeStripper2.ResolveFromMonoBehaviours.Process (Mono.Linker.LinkContext context) [0x00000] in :0
at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00000] in :0
at Mono.Linker.Driver.Run () [0x00000] in :0
at Mono.Linker.Driver.RunDriver (Mono.Linker.Driver driver) [0x00000] in :0
stderr:

UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:66)
UnityEditorInternal.AssemblyStripper:RunAssemblyLinker(IEnumerable1, String&, String&, String, String) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:192) UnityEditorInternal.AssemblyStripper:StripAssembliesTo(String, String, String&, String&, String, String, IEnumerable1) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:185)
UnityEditorInternal.AssemblyStripper:Strip(String, String, String&, String&, String, String, IEnumerable1) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:136) UnityEditorInternal.AssemblyStripper:Strip(String[ ], String[ ], String, String, String&, String&, String, String, IEnumerable1) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:121)
UnityEditorInternal.IL2CPPBuilder:RunAssemblyStripper(IEnumerable, String, String[ ], String[ ], String) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:441)
UnityEditorInternal.IL2CPPBuilder:StripAssemblies(IEnumerable1, String) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:414) UnityEditorInternal.IL2CPPBuilder:Run() (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:291) UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action1, RuntimeClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:211)
UnityEditor.HostView:OnGUI()

------------Error 2-------------
Exception: /Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper2/UnusedBytecodeStripper2.exe did not run properly!
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:68)
UnityEditorInternal.AssemblyStripper.RunAssemblyLinker (IEnumerable1 args, System.String& out, System.String& err, System.String linkerPath, System.String workingDirectory) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:192) UnityEditorInternal.AssemblyStripper.StripAssembliesTo (System.String outputFolder, System.String workingDirectory, System.String& output, System.String& error, System.String linkerPath, System.String descriptorsFolder, IEnumerable1 additionalBlacklist) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:185)
UnityEditorInternal.AssemblyStripper.Strip (System.String outputFolder, System.String workingDirectory, System.String& output, System.String& error, System.String monoLinkerPath, System.String descriptorsFolder, IEnumerable1 additionalBlacklist) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:136) UnityEditorInternal.AssemblyStripper.Strip (System.String[ ] assemblies, System.String[ ] searchDirs, System.String outputFolder, System.String workingDirectory, System.String& output, System.String& error, System.String monoLinkerPath, System.String descriptorsFolder, IEnumerable1 additionalBlacklist) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:121)
UnityEditorInternal.IL2CPPBuilder.RunAssemblyStripper (IEnumerable assemblies, System.String managedAssemblyFolderPath, System.String[ ] assembliesToStrip, System.String[ ] searchDirs, System.String monoLinkerPath) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:441)
UnityEditorInternal.IL2CPPBuilder.StripAssemblies (IEnumerable1 assemblies, System.String managedAssemblyFolderPath) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:414) UnityEditorInternal.IL2CPPBuilder.Run () (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:291) UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, IIl2CppPlatformProvider platformProvider, System.Action1 modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:211)
UnityEditor.iOS.PostProcessiPhonePlayer.PostProcess (UnityEditor.iOS.iOSBuildPostprocessor pp, BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String stagingAreaDataManaged, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.iOS.iOSBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316)
UnityEditor.HostView:OnGUI()

-------------- Error 3-----------
Error building Player: Exception: /Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper2/UnusedBytecodeStripper2.exe did not run properly!

I have been having the same error since updating to Unity 5.2. Currently working on identifying and attempting to solve the problem. Any help is greatly appreciated.

Mohit, are you using any third-party plugins in this Unity Project? If so which ones?

I wonder if System.Security.Principal.GenericIdentity is being incorrectly stripped from mscorlib.dll. With the Mono scripting backend, is stripped disabled? If so, it may be necessary to use a link.xml file to ensure that the mscorlib.dll assembly is not stripped. You can find some details about how to do this here:

I found another post with a similar problem that had a valid workaround. I used it and my project is building fine. I was unable to diagnose the exact cause of the problem but this is what solved it.

  1. Change stripping backend from il2cpp to Mono in build settings
  2. Change stripping level to ‘strip byte code’
  3. Revert stripping backend to il2cpp

I can’t find the forum post that describes this workaround but this is what solved the problem.

6 Likes

@a1fonzo

Did you happen to have the stripping level set to “Use micro mscorlib” in the Mono player settings? If so, then this is a known bug that we have corrected in the latest 5.2 patch release. If not, then we have another, different bug that we need to correct.

i happen to have the stripping level set to “use micro mscorlib”, i follow the steps above and solved the problem.

Hi I’m also having the similar issue and still cannot solve the problem even after trying the workaround from @a1fonzo

p.s. I’m currently using Unity5.2.1p2

I’ having this problem in Unity 4.6.9.f1 I cannot build to ios on any stripping level, even disabled

Same problem. No damn solution!?

@a1fonzo thanks, i followed the above steps and its working fine!

I got similar error when I tried to run my project in WebGL: I fixed it by:

I found the solution by copy pasting the error into notebook++.

Failed running C:\Unity5\Editor\Data\Tools/UnusedByteCodeStripper2/UnusedBytecodeStripper2.exe -out
stdout:

etc etc…

Fatal error in Mono CIL Linker
System.Exception: Error processing method: ‘UnityEngine.AudioClip ES2Reader::Read_AudioClip()’ in assembly: ‘ES2.dll’ —> Mono.Cecil.ResolutionException: Failed to resolve System.Void UnityEngine.AudioClip::SetData(System.Single[ ],System.Int32)

etc.

The ES2 was Easy Save 2. The author had an update. Updated and then the error went away. Others may have a different dll that it has an issue with.

I had to up my versioning to iOS 8 from iOS 7.

I am having the same issue. I been trying to fix it but still it fails during the Build for WebGL.
Unity Version : 5.3.3f

Thank You

_-------------------------------------------------------
Here is the error message below.
Failed running C:\Program Files\Unity\Editor\Data\Tools/UnusedByteCodeStripper2/UnusedBytecodeStripper2.exe -out “C:\EBS2\EBS Unity\Temp\StagingArea\Data\Managed\tempStrip” -l none -c link -b False -x “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\Whitelists\Core.xml” -f “C:\Program Files\Unity\Editor\Data\il2cpp\LinkerDescriptors” -x “C:\EBS2\EBS Unity/Temp/StagingArea/Data/methods_pointedto_by_uievents.xml” -x “C:\EBS2\EBS Unity\Temp\StagingArea\Data\preserved_derived_types.xml” -d “C:\EBS2\EBS Unity\Temp\StagingArea\Data\Managed” -a “C:\EBS2\EBS Unity\Temp\StagingArea\Data\Managed\Assembly-CSharp-firstpass.dll” -a “C:\EBS2\EBS Unity\Temp\StagingArea\Data\Managed\Assembly-CSharp.dll” -a “C:\EBS2\EBS Unity\Temp\StagingArea\Data\Managed\Assembly-UnityScript-firstpass.dll” -a “C:\EBS2\EBS Unity\Temp\StagingArea\Data\Managed\Bluedrop.EPSS3D.Common.dll” -a “C:\EBS2\EBS Unity\Temp\StagingArea\Data\Managed\Bluedrop.EPSS3D.Runtime.dll” -a “C:\EBS2\EBS Unity\Temp\StagingArea\Data\Managed\HighlightingSystem.dll” -a “C:\EBS2\EBS Unity\Temp\StagingArea\Data\Managed\NGUI.dll”

stdout:
Fatal error in Mono CIL Linker
System.Exception: Error processing method: ‘System.Void HighlightableObject::InitMaterials()’ in assembly: ‘HighlightingSystem.dll’ —> Mono.Cecil.ResolutionException: Failed to resolve UnityEngine.ClothRenderer
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
— End of inner exception stack trace —
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Pipeline.Process(LinkContext context)
at Mono.Linker.Driver.RunDriver(Driver driver)
stderr:

UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:94)
UnityEditorInternal.AssemblyStripper:RunAssemblyLinker(IEnumerable1, String&, String&, String, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:107) UnityEditorInternal.AssemblyStripper:StripAssembliesTo(String[ ], String[ ], String, String, String&, String&, String, IIl2CppPlatformProvider, IEnumerable1, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:100)
UnityEditorInternal.AssemblyStripper:RunAssemblyStripper(String, IEnumerable, String, String[ ], String[ ], String, IIl2CppPlatformProvider, RuntimeClassRegistry, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:204)
UnityEditorInternal.AssemblyStripper:StripAssemblies(String, IIl2CppPlatformProvider, RuntimeClassRegistry, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:131)
UnityEditorInternal.IL2CPPBuilder:Run() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:201)
UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:135)
UnityEditor.PostprocessBuildPlayer : ostprocess(BuildTarget, String, String, String, Int32, Int32, String, String, BuildOptions, RuntimeClassRegistry)

@prabushan

Amidst all of this output, the important error message is:

‘System.Void HighlightableObject::InitMaterials()’ in assembly: ‘HighlightingSystem.dll’ —> Mono.Cecil.ResolutionException: Failed to resolve UnityEngine.ClothRenderer

It looks like the UnityEngine.ClothRenderer type is not being found. I’m not entirely sure why. You could have a look at the UnityEngine.dll assembly in ILSpy and see if it has a ClothRenderer type. It may be the case that HighlightingSystem.dll was built with a different version of Unity than you are currently using to build this project.

Thank You Josh Peterson.

I will check that out.

  1. The project was created in 2013/2014 by another company. The project worked fine with old Web Player but after an updates to the Web Player, there is minor errors in the project.
  2. Now I have the new version of Unity and I was trying to build the project using the WebGL so its works with all the browser without the web player.

I am new to Unity, and I am not familiar with all the settings yet.

Hi all I had same problem and such steps fixed it:

[I was on iOS platform]

  1. Delete link.xml
  2. switch to other platform
  3. switch back to iOS platform

Above fixed this one for me, hope it will help others.

4 Likes

THANKS! I have just run into the same issue. Your workaround helped.

For me, just deleting link.xml was enough :slight_smile:

Tried mentioned methods above, did not solve problem for me.