Search Unity

Strange issues when attempting to build on Linux with IL2CPP

Discussion in 'Linux' started by KMacro, Nov 4, 2019.

  1. KMacro

    KMacro

    Joined:
    Jan 7, 2019
    Posts:
    48
    I am using 2019.3.0b9

    The target platform for my project is Linux, but I usually build from a Windows machine. On Windows, only the Mono scripting backend is available for Linux. I wanted to try a build with IL2CPP, so I moved my project over to a machine running Ubuntu and tried to build it in the Linux Editor.

    The first error I ran into was the build failing and an error message complaining about not being able to run il2cpp.exe because there was no file located at usr/bin/clang (I don't have the exact text of the error because it seemed to be resolved by the following). I installed Clang, and this seemed to resolve the issue.

    After this, builds now complete successfully. However, whereas on Windows successful completion of a build opens the folder where that build is located, when a build finishes on Linux it opens the audio player "Audacious" with an error "No files found". There is still a "Build completed with a result of 'Succeeded'" message in the Editor console.

    When I go to run the executable that has been generated, I get a lot of flashing garbage accompanied by some of the assets in my game in incorrect positions.

    I see several errors like the following in the Player log:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object.
    2.   at System.Linq.Expressions.Interpreter.LightLambda.MakeRunDelegateCtor (System.Type delegateType) [0x00000] in <00000000000000000000000000000000>:0
    3.   at System.Linq.Expressions.Interpreter.LightLambda.GetRunDelegateCtor (System.Type delegateType) [0x00000] in <00000000000000000000000000000000>:0
    4.   at System.Linq.Expressions.Interpreter.LightDelegateCreator.CreateDelegate (System.Runtime.CompilerServices.IStrongBox[] closure) [0x00000] in <00000000000000000000000000000000>:0
    5.   at Newtonsoft.Json.Utilities.ExpressionReflectionDelegateFactory.CreateParameterizedConstructor (System.Reflection.MethodBase method) [0x00000] in <00000000000000000000000000000000>:0
    6.   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract (System.Type objectType) [0x00000] in <00000000000000000000000000000000>:0
    7.   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract (System.Type objectType) [0x00000] in <00000000000000000000000000000000>:0
    8.   at System.Func`2[T,TResult].Invoke (T arg) [0x00000] in <00000000000000000000000000000000>:0
    9.   at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].GetOrAdd (TKey key, System.Func`2[T,TResult] valueFactory) [0x00000] in <00000000000000000000000000000000>:0
    10.   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x00000] in <00000000000000000000000000000000>:0
    11.   at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in <00000000000000000000000000000000>:0
    12.   at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <00000000000000000000000000000000>:0
    13.   at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <00000000000000000000000000000000>:0
    14.   at UnityEngine.GameObject.AddComponent[T] () [0x00000] in <00000000000000000000000000000000>:0
    15. UnityEngine.GameObject:AddComponent()
    What can I do to get a working executable from building on Ubuntu with IL2CPP?
     
  2. KMacro

    KMacro

    Joined:
    Jan 7, 2019
    Posts:
    48
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Does your game work properly? Did you not encounter this IL2CPP issue when building for Windows?
     
  4. KMacro

    KMacro

    Joined:
    Jan 7, 2019
    Posts:
    48
    My game is working properly now. As my target platform is Linux and I am developing primarily on Windows, I had only ever been making builds with a Mono backend. I have not tried a Windows build with IL2CPP but I would imagine I would have seen the same error, since it turned out to be with IL2CPP and the json library, not specifically Linux or the Linux Editor.
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
  6. KMacro

    KMacro

    Joined:
    Jan 7, 2019
    Posts:
    48
    Thanks for the link. I got some odd behavior while fixing it, but ultimately I was able to do it. Here's what I did for posterity:
    1. I checked my default file browser with "xdg-mime query default inode/directory". It was properly set to "pcmanfm.desktop"
    2. I went into "audacious.desktop" and saw that "inode/directory" was set as one of its defaults. I deleted this, saved, rebuilt my game in Unity, and Audacious still opened.
    3. I explicitly set pcmanfm as the default file browser with "xdg-mime default pcmanfm.desktop inode/directory" even though it was already set as the default. When I did this and then rebuilt in Unity, the build folder now properly opens in PCManFM.

    Hope this can help someone!
     
  7. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Hi since this thread is relatively new - just had a question. The bug report page says:
    Is this something thats on the horizon? There isn't really anywhere to keep 'track' of the state of this, so we wont really know when it is 'done' until one day it is.
     
    erlioniel likes this.