Search Unity

Failed to create IL2CPP build on OSX

Discussion in 'macOS' started by sevensails, May 10, 2018.

  1. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    I can't build using IL2CPP on OSX. Mono is Working Fine.

    Code (csharp):
    1.  
    2. Failed running /Volumes/Dados/XCode/Programas/Unity/Hub/Editor/2018.1.0f2/Unity.app/Contents/il2cpp/build/il2cppcore/il2cppcore.dll --convert-to-cpp --emit-null-checks --enable-array-bounds-check --compile-cpp --libil2cpp-static --platform="MacOSX" --architecture="x64" --configuration="Release" --outputpath="/Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Temp/StagingArea/Data/Native/GameAssembly.dylib" --cachedirectory="/Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Assets/../Library/il2cpp_cache" --map-file-parser="/Volumes/Dados/XCode/Programas/Unity/Hub/Editor/2018.1.0f2/Unity.app/Contents/Tools/MapFileParser/MapFileParser" --assembly="/Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Temp/StagingArea/Data/Managed/Assembly-CSharp-firstpass.dll" --assembly="/Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Temp/StagingArea/Data/Managed/Assembly-CSharp.dll" --assembly="/Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Temp/StagingArea/Data/Managed/Assembly-UnityScript-firstpass.dll" --assembly="/Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Temp/StagingArea/Data/Managed/Assembly-UnityScript.dll" --assembly="/Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Temp/StagingArea/Data/Managed/Unity.TextMeshPro.dll" --assembly="/Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Temp/StagingArea/Data/Managed/UnityEngine.UI.dll" --assembly="/Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Temp/StagingArea/Data/Managed/DOTween.dll" --assembly="/Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Temp/StagingArea/Data/Managed/UnityEngine.Analytics.dll" --assembly="/Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Temp/StagingArea/Data/Managed/UnityEngine.dll" --assembly="/Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Temp/StagingArea/Data/Managed/Stores.dll" --assembly="/Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Temp/StagingArea/Data/Managed/UnityEngine.Purchasing.dll" --assembly="/Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Temp/StagingArea/Data/Managed/mscorlib.dll" --generatedcppdir="/Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Temp/StagingArea/Data/il2cppOutput"
    3.  
    4. stdout:
    5. Building GameAssembly.dylib with ClangToolChain.
    6.     Output directory: /Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Temp/StagingArea/Data/Native
    7.     Cache directory: /Volumes/Dados/Games/Unity/games/Match3/Seven Sails Games/Queens Garden 4 - Sakura Season/Library/il2cpp_cache
    8. il2cpp.exe didn't catch exception: System.InvalidOperationException: Sequence contains no matching element
    9.   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
    10.   at Unity.IL2CPP.Building.ToolChains.ClangToolChain.<ToolChainIncludePaths>c__Iterator1.MoveNext()
    11.   at System.Linq.Enumerable.ConcatIterator`1.MoveNext()
    12.   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
    13.   at Unity.IL2CPP.Building.Hashing.FileHashProvider.Initialize(IEnumerable`1 cppSourceCompileInstructions)
    14.   at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
    15.   at il2cpp.Program.DoRun(String[] args)
    16.   at il2cpp.Program.Run(String[] args)
    17.   at il2cpp.Program.Main(String[] args)
    18. stderr:
    19.  
    20. Unhandled Exception: System.InvalidOperationException: Sequence contains no matching element
    21.   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
    22.   at Unity.IL2CPP.Building.ToolChains.ClangToolChain.<ToolChainIncludePaths>c__Iterator1.MoveNext()
    23.   at System.Linq.Enumerable.ConcatIterator`1.MoveNext()
    24.   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
    25.   at Unity.IL2CPP.Building.Hashing.FileHashProvider.Initialize(IEnumerable`1 cppSourceCompileInstructions)
    26.   at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
    27.   at il2cpp.Program.DoRun(String[] args)
    28.   at il2cpp.Program.Run(String[] args)
    29.   at il2cpp.Program.Main(String[] args)
    30.   at Program.Main(String[] args)
    31.  
    32. UnityEngine.Debug:LogError(Object)
    33. UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:128)
    34. UnityEditorInternal.Runner:RunNetCoreProgram(String, String, String, CompilerOutputParserBase, Action`1) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:79)
    35. UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List`1, Action`1, String) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:360)
    36. UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(ICollection`1, String, String, Boolean) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:343)
    37. UnityEditorInternal.IL2CPPBuilder:Run() (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:162)
    38. UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:42)
    39. DesktopStandalonePostProcessor:SetupStagingArea(BuildPostProcessArgs) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:192)
    40. DesktopStandalonePostProcessor:PostProcess(BuildPostProcessArgs) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:20)
    41. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    42.  
    43.  
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    I believe this is an issue that has been corrected. Which version of Unity are you using?
     
  3. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    Unity 2018.1.0f2
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    Look for a fix coming in one of the first patch releases for 2018.1. The fix did not make the cut-off for the feature release, unfortunately.

    The release notes for the fix will look like this:

    IL2CPP: Prevent an error during code conversion related to a missing RGCTX entry for type T that can occur with an unbox opcode for a nullable type. (case 1019586)
     
    sevensails likes this.
  5. hogwash

    hogwash

    Joined:
    Oct 12, 2012
    Posts:
    117
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    Yes, I've merged the fix into 2018.1.2f1, which is scheduled to be published on May 25.
     
    hogwash likes this.
  7. hogwash

    hogwash

    Joined:
    Oct 12, 2012
    Posts:
    117
    @JoshPeterson: FYI we are seeing this issue in 2018.2.0b4 as well even though that case number is marked as being fixed.
     
  8. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    Yes, this should have been corrected in 2018.2.0b1. There might be a subtly different issue occurring now though. Can you submit a bug report for this issue against 2018.2.0b4?
     
  9. hogwash

    hogwash

    Joined:
    Oct 12, 2012
    Posts:
    117
    @JoshPeterson Ok I did some investigation by decompiling UnityEditor.IL2CPP.Building.dll and found that GetToolchainInfoForOutput calls the following method which assumes Xcode.app lives in /Applications/Xcode.app

    Code (CSharp):
    1.     private NPath MacDevSDKPath()
    2.     {
    3.       if (this._useDependenciesToolChain)
    4.       {
    5.         Unity.IL2CPP.Common.ToolChains.OSX.AssertReadyToUse();
    6.         return Unity.IL2CPP.Common.ToolChains.OSX.MacSDKDirectory;
    7.       }
    8.       NPath sdksParentFolder = new NPath("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs");
    9.       return ((IEnumerable<string>) new string[5]
    10.       {
    11.         "MacOSX10.13.sdk",
    12.         "MacOSX10.12.sdk",
    13.         "MacOSX10.11.sdk",
    14.         "MacOSX10.10.sdk",
    15.         "MacOSX10.9.sdk"
    16.       }).Select<string, NPath>((Func<string, NPath>) (sdk => sdksParentFolder.Combine(new string[1]
    17.       {
    18.         sdk
    19.       }))).First<NPath>((Func<NPath, bool>) (sdk => sdk.DirectoryExists("")));
    20.     }
    At least on our build machine we have multiple versions of Xcode installed, namely 9.01 and 9.2 so I simply created a symbolic link from 9.2 like so from the terminal:

    Code (CSharp):
    1. cd /Applications
    2. ln -s Xcode\ 9.2.app Xcode.app
    After applying this fix I was able to successfully make a build using IL2CPP on OSX. It would be nice to be able to specify the path to Xcode in the build settings.

    Cheers,
    Tom.
     
  10. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Hey can we get a bug report on this? We'd like to address it.
     
  11. hogwash

    hogwash

    Joined:
    Oct 12, 2012
    Posts:
    117
    Ok sent:

    (Case 1041910) Failed to create IL2CPP build on OSX
     
    Last edited: May 25, 2018
  12. tompave

    tompave

    Joined:
    Aug 28, 2017
    Posts:
    8
  13. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    tompave likes this.
  14. BudsofBuds

    BudsofBuds

    Joined:
    Dec 7, 2018
    Posts:
    9
    I'm getting this issue.

    I'm on MacOS building for Android. I'm using Unity 2018.2.0b3 (and I'm nervous about upgrading, as newer versions of Vuphoria don't work with my project - it's been an ongoing battle or I'd be using 2019)

    I have Xcode installed in the default location. I also have the required version of the NDK.
     
  15. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,926
    Can you provide the specific error message you see? The original issue here occurred when building a macOS standalone player, not an Android player. So I suspect the issue you see might be slightly different.