Search Unity

Unity iOS 64 bit support

Discussion in 'iOS and tvOS' started by Mantas-Puida, Dec 23, 2014.

  1. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    @Sscia

    I can't determine the exact cause of the problem from this information, but I believe that you are correct, this is a bug in the IL2CPP code. Could you please submit a bug report that includes a project which reproduces this issue? That will give us the best chance to correct it. Thanks.
     
  2. NG_Matthieu

    NG_Matthieu

    Joined:
    Dec 3, 2014
    Posts:
    2

    You should disable stripping level, from a recent discussion I had with Unity technical, IL2CPP does byte stripping automatically and can cause issues if it is also enabled in player settings...

    change Stripping Level to disable and might solve your issue
     
  3. ccklokwerks

    ccklokwerks

    Joined:
    Oct 21, 2014
    Posts:
    62
    I know this is really not a helpful, but I am getting the same thing as sscia and I do have byte stripping turned off. Unfortunately I am unlikely to be able to have the time to create an isolated case for a bug report.

    What I can say...
    - it's also in Bulk_Generics files
    - API Compatibility Level is .Net 2.0, stripping level is disabled
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    @ccklokwerks

    Would it be possible for you to submit the entire project, or least the managed assemblies used to generated this C++ code? That might help us track down the cause of the bug. Thanks.
     
  5. CastleIsGreat

    CastleIsGreat

    Joined:
    Nov 10, 2014
    Posts:
    176
    Hello, my project builds fine in mono 2.x, but is failing at post processing (unity locks up) when I try building in IL2CPP. Anything generic that could be causing this?

    Hold that thought, doing things, installing unity 5.1 aswell to see if thats fixes anything.

    It does not seem to have fixed anything, I am noticing a large amount of console window hosts, and unity shader compilers in my task manager processes.
     
    Last edited: Jun 10, 2015
  6. ccklokwerks

    ccklokwerks

    Joined:
    Oct 21, 2014
    Posts:
    62
    Building with IL2CPP takes a lot longer and may give the appearance that Unity has in fact locked up.
     
  7. CastleIsGreat

    CastleIsGreat

    Joined:
    Nov 10, 2014
    Posts:
    176
    what I am notic
    Oh, I'll let it sit for a bit then I suppose. I've actually gotta go for a little bit, but i'm going to give it another shot when I get back. As I was saying though theres atleast 9 instances of shader compiler running in my processes.

    Could it maybe be a shader that is not wanting to compile? a substance perhaps?

    EDIT: Odd, but it finished, took like 15 minutes, 32 bit takes a minute or two at most, but I cant complain! Also iOS requires 64bit now I believe as of June 1st.
     
    Last edited: Jun 10, 2015
  8. CastleIsGreat

    CastleIsGreat

    Joined:
    Nov 10, 2014
    Posts:
    176
    On a side note, is it normal to have 402 caution flags when building? Things like value conversion issue and depreciations... It builds and runs fine, but is that going to look bad to the app store reviewers?
     
  9. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    Are you seeing those in XCode? I think those are normal. It's not going to affect your final build.
     
    CastleIsGreat likes this.
  10. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    @CastleIsGreat

    Yes, this is normal. We've not heard about any app rejections from Apple due to these warnings. However, please let us know if they do cause a problem for your app submission. Thanks.
     
    CastleIsGreat likes this.
  11. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    So what's the problem with all the value conversion issue warnings? I Never saw those before Unity 5, and still seeing them with 5.1 Is the problem going to be fixed?
     
  12. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    @John B

    I don't believe that these warnings cause a problem. I am a bit surprised that they show up in 5.1 and not in 5.0 though. The IL2CPP version in all Unity releases is very similar. We ship the same IL2CPP code in 4.6, 5.0, and 5.1. If you have a specific warning that shows up in 5.1 and not in 5.0, then I am interested to see what it is.

    We likely will not prevent these warnings in the generated code soon. I would like to correct them in the future, but since they are benign, correcting them is lower priority now.
     
  13. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    Sorry, not what I meant. I actually started seeing that warning in 4.5 or 4.6, when I first tried using IL2CPP. I continued to see the error in 5.0 and now 5.1.
     
  14. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    @John B

    Ok, that makes sense, thanks. These warnings occur only in the C++ code generated by the IL2CPP scripting backend. Thanks for clarifying.
     
  15. Catacomber

    Catacomber

    Joined:
    Sep 22, 2009
    Posts:
    682
    Well, we had 365 of those benign warning messages (value conversion) using 4.6.5 f1 and our 425mb universal RPG game Omber was approved for sale today in the App Store. The benign error messages did not apparently send up any red flag. I was a lot more worried that the code plugging in a link to my website would cause a problem, but not at all.

    :)

    Very happy and moving on now to Unity 5, where if I still have these error messages will not worry. Hopefully eventually they will disappear. Thanks for a great engine.
     
    Last edited: Jun 17, 2015
  16. kenfalco

    kenfalco

    Joined:
    Jul 18, 2012
    Posts:
    27
    Hello,
    since when we switched to IL2CPP scripting engine (for 64bit compatibility) we have several users report random freezes. After investigation we found out that the function Resources.UnloadUnusedAssets hangs (seems an infinite loop since it's not a crash) with the following call stack that I got by pausing the app.



    Due to a large number of textures used to display the user's avatars we put a call to Resources.UnloadUnusedAssets every time an avatar is not used for more than 10 seconds. For this reason, with a lot of connected users, we could execute this function many times at second, but this never did cause problems in the past. We are going to change our code to call the function less frequently and hope it will not hang.
    Is anyone else having a similar problem? Are there specific caveats to using the UnloadUnusedAssets function?

    We don't have any problem with the Android and PC versions, we patched Unity to version 4.6.6p2.
     
    Last edited: Jun 17, 2015
  17. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    @kenfalco

    Is this something that we could see in a bug report? We've had a few bugs in this code, but nothing quite like this hang, so we would like to get it in the debugger if possible. Thanks.
     
  18. ColinAmuzo

    ColinAmuzo

    Joined:
    Mar 20, 2013
    Posts:
    46
    Hi

    We are getting the following crash on iOS arm64 and Universal builds (not armv7). The attached screen shot is from a development build, but the crash occurs on normal builds also.

    Can you tell from the screenshot what the issue might be? I have not submitted a formal bug report yet.
     

    Attached Files:

  19. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    @Colin4T2

    Unfortunately, I cannot tell what the cause is from this screen shot. If you can submit the project with a bug report, that will be the best option. Also, can you let us know what the marshaling directives look like in this code? It seems that you might be marshaling a string (maybe as a return value, it is tough to tell). That might be the cause of the problem. Thanks!
     
  20. ColinAmuzo

    ColinAmuzo

    Joined:
    Mar 20, 2013
    Posts:
    46
    Hi Josh

    Thanks for the response, but I managed to move past this issue by updating the Tapjoy plugin that we're using. For some reason I missed the Tapjoy references in the call stack....it was late! :)

    Regarding marshaling directives...you've lost me, I'm not familiar with the term. But if something looks wrong to you, could you elaborate a bit more please?
     
  21. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    @Colin4T2

    I'm glad that you were able to work things out. Based on the call stack, it looks like the crash happened in string marshaling code (when managed code needs to call into native code). Marshaling directives are attributes applied to arguments of a method or fields of a struct to tell the Managed compiler how to convert the data from managed to native code. They are usually something like this:

    Code (CSharp):
    1. [MashalAs(UnmanagedType.LPStr)]
    This marshaling directive tells the managed compiler to treat a managed string as a char* in native code.

    However, if everything if working now, this problem is likely safe to ignore.
     
  22. kenfalco

    kenfalco

    Joined:
    Jul 18, 2012
    Posts:
    27
    The Resources.UnloadUnusedAssets look like has been resolved in
    Patch 4.6.6p3

    (700507) - iOS/IL2CPP: Avoid deadlock during UnloadUnusedAssets.
     
  23. ColinAmuzo

    ColinAmuzo

    Joined:
    Mar 20, 2013
    Posts:
    46
    Ah I see. Thanks for the explanation. I've not seen any such attribute usage in our code, but there may be in the Tapjoy code. But like you say, all seems to be working now so I'll leave it alone.

    Cheers.
     
  24. MigrantP

    MigrantP

    Joined:
    Jun 24, 2013
    Posts:
    118
    We use GetManifestResourceStream in our game for embedded resources. It's been working great on 64 bit devices, but today we've discovered that it's not working on 32 bit devices! There's no exception, but GetManifestResourceStream always returns null. We're using Unity 5.0.3p2 at the moment. I'm going to try updating to 5.1.1 and see if that helps, but wanted to post here about it in the meantime in case this is something still outstanding.
     
  25. MigrantP

    MigrantP

    Joined:
    Jun 24, 2013
    Posts:
    118
    Hmm, unfortunately I cannot even build for iOS on 5.1.1. I'm getting an exception:

    Code (csharp):
    1.  
    2. NullReferenceException: Object reference not set to an instance of an object
    3. UnityEditor.PluginImporter+<GetImporters>c__AnonStoreyE.<>m__F (UnityEditor.PluginImporter imp) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/PluginImporterBindings.gen.cs:107)
    4. System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[UnityEditor.PluginImporter].MoveNext ()
    5. System.Collections.Generic.List`1[UnityEditor.PluginImporter].AddEnumerable (IEnumerable`1 enumerable) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:128)
    6. System.Collections.Generic.List`1[UnityEditor.PluginImporter]..ctor (IEnumerable`1 collection) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:65)
    7. System.Linq.Enumerable.ToArray[PluginImporter] (IEnumerable`1 source)
    8. UnityEditor.PluginImporter.GetImporters (System.String platformName) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/PluginImporterBindings.gen.cs:106)
    9. UnityEditor.PluginImporter.GetImporters (BuildTarget platform) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/PluginImporterBindings.gen.cs:114)
    10. UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache, BuildTarget target) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:123)
    11. UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, BuildTarget target) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:192)
    12. UnityEditor.HostView:OnGUI()
    13.  
    Calling PluginImporter.GetAllImporters() reveals there are two null entries. Not sure how I can find out what they are though. If I call PluginImporter.GetImporters(BuildTarget.iOS) I get that exception immediately.
     
  26. MigrantP

    MigrantP

    Joined:
    Jun 24, 2013
    Posts:
    118
    Interestingly, in 5.1.1p1 I get an additional error first:

    Code (csharp):
    1.  
    2. NullReferenceException: Object reference not set to an instance of an object
    3. UnityEditor.Modules.DefaultPluginImporterExtension+<GetCompatiblePlugins>c__AnonStorey6F.<>m__F9 (UnityEditor.PluginImporter imp) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Modules/DefaultPluginImporterExtension.cs:133)
    4. System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[UnityEditor.PluginImporter].MoveNext ()
    5. System.Collections.Generic.List`1[UnityEditor.PluginImporter].AddEnumerable (IEnumerable`1 enumerable) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:128)
    6. System.Collections.Generic.List`1[UnityEditor.PluginImporter]..ctor (IEnumerable`1 collection) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:65)
    7. System.Linq.Enumerable.ToArray[PluginImporter] (IEnumerable`1 source)
    8. UnityEditor.Modules.DefaultPluginImporterExtension.GetCompatiblePlugins (System.String buildTargetName) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Modules/DefaultPluginImporterExtension.cs:133)
    9. UnityEditor.Modules.DefaultPluginImporterExtension.CheckFileCollisions (System.String buildTargetName) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Modules/DefaultPluginImporterExtension.cs:157)
    10. UnityEditorInternal.PluginsHelper.CheckFileCollisions (BuildTarget buildTarget) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Plugins/PluginsHelper.cs:25)
    11. UnityEditor.HostView:OnGUI()
    And then what looks to be the same exception:
    Code (csharp):
    1.  
    2. NullReferenceException: Object reference not set to an instance of an object
    3. UnityEditor.PluginImporter+<GetImporters>c__AnonStoreyE.<>m__F (UnityEditor.PluginImporter imp) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/PluginImporterBindings.gen.cs:107)
    4. System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[UnityEditor.PluginImporter].MoveNext ()
    5. System.Collections.Generic.List`1[UnityEditor.PluginImporter].AddEnumerable (IEnumerable`1 enumerable) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:128)
    6. System.Collections.Generic.List`1[UnityEditor.PluginImporter]..ctor (IEnumerable`1 collection) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:65)
    7. System.Linq.Enumerable.ToArray[PluginImporter] (IEnumerable`1 source)
    8. UnityEditor.PluginImporter.GetImporters (System.String platformName) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/PluginImporterBindings.gen.cs:106)
    9. UnityEditor.PluginImporter.GetImporters (BuildTarget platform) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/PluginImporterBindings.gen.cs:114)
    10. UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache, BuildTarget target) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:123)
    11. UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, BuildTarget target) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:192)
    12. UnityEditor.HostView:OnGUI()
    Error building Player: Extracting referenced dlls failed.
     
  27. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    @MigrantP

    Is it possible to submit a bug for this issue? Our internal tests for GetManifestResourceStream on ARMv7 are passing, so there must be something different about your situation that we are missing.

    I'm not certain about the other 5.1 errors. Those look like they may be unrelated to IL2CPP. I expect that the IL2CPP behavior will be the same on 5.0 and 5.1 though, as we ship the same version of IL2CPP in all releases. I think your best option will be to submit a bug and let me know the bug number here. Thanks!
     
  28. MigrantP

    MigrantP

    Joined:
    Jun 24, 2013
    Posts:
    118
    Thanks Josh! I'll see if I can make a small test case for the embedded resource problem and submit a bug.

    Comparing GetAllImporters() between PC platform and iOS platform reveals the problem: the missing one (twice) is /Applications/Unity5.1.1/Unity.app/Contents/UnityExtensions/Unity/Networking/Editor/UnityEditor.Networking.dll

    The same thing happens on Android platform too.

    I noticed that Unity wants to rebuild the project when updating now. We use Fast Platform Switch because switching platforms manually in our project takes several hours (especially for iOS and Android). I updated the project on the PC platform (since that only takes about 15 minutes), so it looks like something in the "rebuild" is platform specific.

    Is there a way to get Unity to do that rebuild operation again?
     
  29. MigrantP

    MigrantP

    Joined:
    Jun 24, 2013
    Posts:
    118
    @JoshPeterson

    I made a small test project for Unity 5.1.1 and found that GetManifestResourceStream doesn't work on device for either 32 bit or 64 bit now. It works in the editor.

    I reported a bug through the bug reporter tool and the number is 707132.
     
  30. MigrantP

    MigrantP

    Joined:
    Jun 24, 2013
    Posts:
    118
    Looks like we're going back to 5.0.2p2 for the moment because that's the last version I have that fully works. Let me know if there's any more info/etc I can provide!
     
  31. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    @MigrantP

    Thanks for submitting this bug report. We will investigate it.

    I'm not sure about how to get Unity to do the rebuild operation again, sorry. I've asked a few others and I'll respond here if we find an answer.
     
  32. JumboWu

    JumboWu

    Joined:
    Nov 25, 2014
    Posts:
    9
    @JoshPeterson
    upload_2015-6-25_19-19-12.png Xcode error.png

    Xcode 6.3.1 and Unity 4.6.6f2, How can I fix it?
     
  33. JumboWu

    JumboWu

    Joined:
    Nov 25, 2014
    Posts:
    9
    Attach playersetting capture.
     

    Attached Files:

  34. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    @Jump_Wu

    It looks like something in the GetMonoHeapSize method in managed code is attempting to call native mono_* functions, which do not exist with IL2CPP. Your best approach is to comment out or remove that code. That should at least get things to build.

    If you can let me know what the is going in that case, we might be able to suggest a work around for IL2CPP.
     
  35. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    I'm abit confused about 64bit requirements... in Unity docs here... http://docs.unity3d.com/Manual/iphone-64bit.html
    il2cpp seems like this mode is required for 64-bit ? but I'm pretty sure I shipped an update to an iOS app, without this switiched on, after the Apple deadline...
    So question is... is il2cpp required ? or just a new 64bit feature/option with some more performance benefits ?
     
  36. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    @JonnyHilly

    The IL2CPP scripting backend is required to perform an 64-bit build in Xcode (ARM64 architecture). The Mono scripting backend only does 32-bit builds (ARMv7 architecture).

    I'm not sure though if anything can make it past Apple's checks.
     
  37. Deleted User

    Deleted User

    Guest

    Since Apple now requires 64-bit builds, why is IL2CPP not the default for iOS? Seems like a bug.
     
  38. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    @bn3d

    On 5.0, 5.1, and 5.2, the IL2CPP scripting backend is the default. We've left Mono2x as the default on 4.6 to avoid making any more changes than necessary to the 4.6 Unity editor. I suppose that it is something we could relatively easily change, but so far it has not been a priority.
     
  39. Deleted User

    Deleted User

    Guest

    Odd. Started the project in a 5.0 patch release. It's been Mono2x. 'Course googling eventually got me what I needed, but just looking at the Editor UI, 'Scripting Backend' is less informative than '32-bit only' vs '32+64-bit' for that drop-down's label.
     
  40. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    @bn3d

    Maybe I am incorrect then, IL2CPP may not have been the default until 5.1, sorry. Note also that IL2CPP does not necessarily imply 64-bit. You can us the Architecture option in the iOS player settings to specify armv7 only, which is 32-bit. But for iOS app submissions, you want the Architecture option to be Universal (which should be the default).
     
  41. Deleted User

    Deleted User

    Guest

    Many thanks
     
  42. kashif786

    kashif786

    Joined:
    Oct 9, 2014
    Posts:
    2
    Please See the following video to understand errors while building for IOS in IL2CPP.

    I did not had this issue with same code base in Unity 4.6.6f2 but have this issue in 4.6.9f1



    Parse Issue
    Expected ')'

    Parse Issue
    Must use 'struct' tag to refer to type 'Object_t' in this scope.


    Please help i am stuck and project has already gone way over timeline.

    Regards
    Kashif
     
  43. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    @kashif786

    This certainly looks like a bug in il2cpp.exe, as it should never generate C++ code that does not compile. Is it possible for you to submit a bug report? If so, please let me know the bug report number, as we would like to get this corrected soon.
     
  44. kashif786

    kashif786

    Joined:
    Oct 9, 2014
    Posts:
    2
    Please explain me to how to report this bug?
     
  45. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    @kashif786

    In the Unity editor, choose Help > Report a Bug. Int he bug reporter, please choose the option to upload your project as well.
     
  46. hacaro76

    hacaro76

    Joined:
    Oct 14, 2015
    Posts:
    25

    hi M40 Dev, have you found a solution, I'm in your same situation.
    Thanks in advance.
     
  47. tech4tall

    tech4tall

    Joined:
    Nov 14, 2015
    Posts:
    3
    Maybe I am incorrect then, IL2CPP may not have been the default until 5.1, sorry. Note also that IL2CPP does not necessarily imply 64-bit. You can us the Architecture option in the iOS player settings to specify armv7 only, which is 32-bit. But for iOS app submissions, you want the Architecture option to be Universal (which should be the default).
     
    Last edited: Nov 18, 2015
  48. eduardocoelho

    eduardocoelho

    Joined:
    Dec 18, 2013
    Posts:
    10