Search Unity

Incremental Compiler support?

Discussion in 'Linux' started by Latty, Jul 18, 2018.

  1. Latty

    Latty

    Joined:
    May 5, 2014
    Posts:
    16
  2. rkas1222

    rkas1222

    Joined:
    Aug 9, 2017
    Posts:
    6
    Yeah, I can't get it to work either.

    If I install the incremental compiler package in the Linux editor, I see what appear to be compiler binaries show up in:
    ~/.config/unity3d/cache/packages/packages.unity.com/com.unity.incrementalcompiler@0.0.42-preview.12/.bin/csc.exe

    This has what seems to be a reasonable file tag:
    $ file csc.exe
    csc.exe: PE32 executable(console) Intel 80386 Mono/.Net assembly, for MS Windows

    However, during installation, I see the following error, with the seemingly relevant UnityEditor.Compilation.RoslynCompilerBootstrap..cctor in the backtrace.

    System.AggregateException: One or more errors occurred. ---> System.TypeInitializationException: The type initializer for 'ZeroMQ.lib.zmq' threw an exception. ---> System.EntryPointNotFoundException: mono_dllmap_insert
    at (wrapper managed-to-native) ZeroMQ.lib.Platform+Posix.mono_dllmap_insert(intptr,intptr,intptr,intptr,intptr)
    at ZeroMQ.lib.Platform+Posix.MonoDllMapInsert (System.String libraryName, System.String libraryPath) [0x0000e] in <89499c667382432583a6a5f1fb22bd37>:0
    at ZeroMQ.lib.Platform+Posix.LoadUnmanagedLibrary (System.String libraryName) [0x0022e] in <89499c667382432583a6a5f1fb22bd37>:0
    at ZeroMQ.lib.zmq..cctor () [0x00588] in <89499c667382432583a6a5f1fb22bd37>:0
    --- End of inner exception stack trace ---
    at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
    at ZeroMQ.ZContext..ctor () [0x00006] in <89499c667382432583a6a5f1fb22bd37>:0
    at UnityEditor.ServiceBroker.Client+<>c__DisplayClass6_0`1[T].<Subscribe>b__0 () [0x00000] in <89b2499c7b794c42a71d5c7a9df49755>:0
    at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <f826c2584fc94ec19a48a6576640bdc5>:0
    at System.Threading.Tasks.Task.Execute () [0x00010] in <f826c2584fc94ec19a48a6576640bdc5>:0
    --- End of inner exception stack trace ---
    at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <f826c2584fc94ec19a48a6576640bdc5>:0
    at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <f826c2584fc94ec19a48a6576640bdc5>:0
    at System.Threading.Tasks.Task.Wait () [0x00000] in <f826c2584fc94ec19a48a6576640bdc5>:0
    at UnityEditor.Compilation.CompilerConnection.SubscribeInternal (System.Int32 millisecondTimeout, System.Boolean retryOnTimeout, System.Int32& attempts) [0x0002c] in <9d25b74f76b44eeb9bf5708cc2c17cc2>:0
    at UnityEditor.Compilation.CompilerConnection.SubscribeInternal (System.Int32 attempts, System.Int32 millisecondTimeout) [0x00000] in <9d25b74f76b44eeb9bf5708cc2c17cc2>:0
    at UnityEditor.Compilation.CompilerConnection.InitializeSingleton () [0x00024] in <9d25b74f76b44eeb9bf5708cc2c17cc2>:0
    at UnityEditor.Compilation.RoslynCompilerBootstrap..cctor () [0x0000a] in <9d25b74f76b44eeb9bf5708cc2c17cc2>:0
    ---> (Inner Exception #0) System.TypeInitializationException: The type initializer for 'ZeroMQ.lib.zmq' threw an exception. ---> System.EntryPointNotFoundException: mono_dllmap_insert
    at (wrapper managed-to-native) ZeroMQ.lib.Platform+Posix.mono_dllmap_insert(intptr,intptr,intptr,intptr,intptr)
    at ZeroMQ.lib.Platform+Posix.MonoDllMapInsert (System.String libraryName, System.String libraryPath) [0x0000e] in <89499c667382432583a6a5f1fb22bd37>:0
    at ZeroMQ.lib.Platform+Posix.LoadUnmanagedLibrary (System.String libraryName) [0x0022e] in <89499c667382432583a6a5f1fb22bd37>:0
    at ZeroMQ.lib.zmq..cctor () [0x00588] in <89499c667382432583a6a5f1fb22bd37>:0
    --- End of inner exception stack trace ---
    at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
    at ZeroMQ.ZContext..ctor () [0x00006] in <89499c667382432583a6a5f1fb22bd37>:0
    at UnityEditor.ServiceBroker.Client+<>c__DisplayClass6_0`1[T].<Subscribe>b__0 () [0x00000] in <89b2499c7b794c42a71d5c7a9df49755>:0
    at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <f826c2584fc94ec19a48a6576640bdc5>:0
    at System.Threading.Tasks.Task.Execute () [0x00010] in <f826c2584fc94ec19a48a6576640bdc5>:0 <---
    UnityEditor.EditorAssemblies:processInitializeOnLoadAttributes()


    Things get strange from there. If I enable compiler errors in Edit > Preferences > Compiler, and then try to ReimportAll, the editor will restart and I see errors of the following type:

    (0,0): GetAnalyzersFromCompilation threw an exception: System.NullReferenceException: Object reference not set to an instance of an object
    at UnityEditor.Compilation.CodeAnalyzerManager+<>c__DisplayClass5_0.<GetAnalyzersFromCompilation>b__0 (UnityEditor.Compilation.CodeAnalyzerManager+CompilationAnalyzerInfo a) [0x00000] in <9d25b74f76b44eeb9bf5708cc2c17cc2>:0
    at System.Linq.Enumerable.SingleOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x0002c] in <839a3cb835c04d14aeb58d83bb7bc4bd>:0
    at UnityEditor.Compilation.CodeAnalyzerManager.GetAnalyzersFromCompilation (System.String assemblyFilename, System.String[] unityCompilerArguments) [0x0003f] in <9d25b74f76b44eeb9bf5708cc2c17cc2>:0
    System.Threading.ThreadHelper:ThreadStart()

    And the very helpful:

    (0,0): One or more errors occurred.

    At this point, the Window > PackageManager window option isn't available in the top level Menu, which is strange.

    If I then restart the Editor, I usually see errors about ref output values, implying that the incremental compiler is disabled. Actually, though, right now, I can't reproduce that.

    So, lots of wonkiness.
     
  3. rkas1222

    rkas1222

    Joined:
    Aug 9, 2017
    Posts:
    6
    One other thing -- if you're trying to use the incremental compiler so as to use the entities package, I was able to get that package to compile by downgrading to 0.0.12-preview.4, which apparently doesn't require the incremental compiler. I haven't tried using it in anger, though, so YMMV.
     
  4. Latty

    Latty

    Joined:
    May 5, 2014
    Posts:
    16
    Unfortunately not, might be useful for others, but for our purposes I am looking for language feature support for c# 7.
     
  5. mneilly

    mneilly

    Joined:
    Feb 13, 2014
    Posts:
    7
    FWIW - there seems to be an issue with library search paths. As a temporary work around the following allows me to run GravityDemo sample with that latest ECS and incremental compiler packages:

    $ (export LD_PRELOAD=/opt/Unity-2018.2.2f1/Editor/Data/MonoBleedingEdge/MonoEmbedRuntime/libmonobdwgc-2.0.so ; /opt/Unity-2018.2.2f1/Editor/Unity)

    You may need to start with a fresh project or remove Temp/* Library/* etc. first.
     
    psuong likes this.
  6. Nodrev

    Nodrev

    Joined:
    Feb 5, 2013
    Posts:
    1
    Great workaround, I can finally use ECS on linux, well done!
    As a side note, I must mention that you'll won't need the additional Incremental Compiler package as it's now shipped inside Unity directly (see "Unity Preference/Compiler" window, note that it does not work without Mneilly trick), and that "pure" ECS still generates some unprecise compilation errors:
    <edit>After checking, it seems that after cleaning Library dir (or using "Assets/reimport all") pure ECS works too</edit>

    Anyway, I was using hybrid ECS so it's all good for me :)
     
    Last edited: Aug 14, 2018
    psuong likes this.