Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newtonsoft dependency missing on IOS #84

Closed
fraidev opened this issue Jun 12, 2023 · 4 comments · Fixed by #85
Closed

Newtonsoft dependency missing on IOS #84

fraidev opened this issue Jun 12, 2023 · 4 comments · Fixed by #85
Assignees

Comments

@fraidev
Copy link
Collaborator

fraidev commented Jun 12, 2023

It is needed to add Newtonsoft dependency manually to build on IOS.

We already have the dependency as a DLL for WebGL, we just need to enable it to IOS as well.

@k-karuna
Copy link
Member

k-karuna commented Jun 13, 2023

@fraidev we have two versions of newtonsoft: for WebGL, and for others platforms. They are both identical. This separation was done after we encountered issues in Unity 2021.3.22+ versions, they have updated Newtonsoft dependency and after that there was conflicts between our SDK Newtonsoft.dll and Unity's one. So, we just renamed Newtonsoft.dll to TezosUnitySDK.Newtonsoft.Json.dll and this works fine, except WebGL bulds, Web builder did't see renamed dll, so our workaround is to use TezosUnitySDK.Newtonsoft.Json.dll for all platforms except Web, and Newtonsoft.dll only for Web.
So,please use corresponding dll for IOS (TezosUnitySDK.Newtonsoft.Json.dll)

@fraidev
Copy link
Collaborator Author

fraidev commented Jun 13, 2023

@fraidev we have two versions of newtonsoft: for WebGL, and for others platforms. They are both identical. This separation was done after we encountered issues in Unity 2021.3.22+ versions, they have updated Newtonsoft dependency and after that there was conflicts between our SDK Newtonsoft.dll and Unity's one. So, we just renamed Newtonsoft.dll to TezosUnitySDK.Newtonsoft.Json.dll and this works fine, except WebGL bulds, Web builder did't see renamed dll, so our workaround is to use TezosUnitySDK.Newtonsoft.Json.dll for all platforms except Web, and Newtonsoft.dll only for Web. So,please use corresponding dll for IOS (TezosUnitySDK.Newtonsoft.Json.dll)

I tried to disable Newtonsoft.dll and to enable TezosUnitySDK.Newtonsoft.Json.dll to IOS, but I got this error:

Exception: Failed running /Applications/Unity/Hub/Editor/2021.3.23f1/Unity.app/Contents/il2cpp/build/deploy/UnityLinker @"/Users/frai/workspace/tezos-unity-sdk-rpg-sample-game/Unity/Temp/StagingArea/Data/Managed/response.rsp"

stdout:
Fatal error in Unity CIL Linker
Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null'
   at Unity.IL2CPP.Common.MissingMethodStubber.GetTypeModule(TypeReference type, IEnumerable`1 assemblies) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Common/MissingMethodStubber.cs:line 178
   at Unity.Linker.Steps.AddUnresolvedStubsStep.MarkAssemblyOfType(UnityLinkContext context, TypeReference type) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker.Steps/AddUnresolvedStubsStep.cs:line 18
   at Unity.Linker.Steps.Marking.UnresolvedStubMarking.HandleUnresolvedType(TypeReference reference) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker.Steps/Marking/UnresolvedStubMarking.cs:line 96
   at Unity.Linker.Steps.UnityMarkStep.HandleUnresolvedType(TypeReference reference) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker.Steps/UnityMarkStep.cs:line 207
   at Mono.Linker.Steps.MarkStep.MarkCustomAttributes(ICustomAttributeProvider provider, DependencyInfo& reason, IMemberDefinition sourceLocationMember) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 590
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, IMemberDefinition sourceLocationMember) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 1446
   at Mono.Linker.Steps.MarkStep.MarkField(FieldDefinition field, DependencyInfo& reason) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 1293
   at Mono.Linker.Steps.MarkStep.MarkEntireTypeInternal(TypeDefinition type, Boolean includeBaseTypes, DependencyInfo& reason, IMemberDefinition sourceLocationMember, HashSet`1 typesAlreadyVisited) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 315
   at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 1159
   at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 204
   at Unity.Linker.Steps.UnityMarkStep.InitializeAssembly(AssemblyDefinition assembly) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker.Steps/UnityMarkStep.cs:line 34
   at Mono.Linker.Steps.MarkStep.Initialize() in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 194
   at Unity.Linker.Steps.UnityMarkStep.Process(LinkContext context) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker.Steps/UnityMarkStep.cs:line 255
   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)

Am I forgetting something?

@k-karuna
Copy link
Member

Oh, seems that issue i am talking about is related to Mono linker. So, i suggest to use Newtonsoft.dll for platforms that use Mono linker (WebGL, IOS) and use TezosUnitySDK.Newtonsoft.Json.dll for others.
Therefore i suggest to exclude IOS platrorm from TezosUnitySDK.Newtonsoft.Json.dll file as well as WebGL.

@fraidev
Copy link
Collaborator Author

fraidev commented Jun 13, 2023

Oh, seems that issue i am talking about is related to Mono linker. So, i suggest to use Newtonsoft.dll for platforms that use Mono linker (WebGL, IOS) and use TezosUnitySDK.Newtonsoft.Json.dll for others. Therefore i suggest to exclude IOS platrorm from TezosUnitySDK.Newtonsoft.Json.dll file as well as WebGL.

Ok, I kept the Newtonsoft.dll to iOS and I added a commit to exclude the iOS platform from TezosUnitySDK.Newtonsoft.Json.dll.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants