Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Failed build

Discussion in 'WebGL' started by andyz, Apr 7, 2016.

  1. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,123
    Just giving webgl a try on a project with 5.3.3 but can not build - get an error like this:

    Failed running "C:\Program Files\Unity5.3.3\Editor\Data\PlaybackEngines\WebGLSupport/BuildTools/Emscripten_Win/python/2.7.5.3_64bit/python.exe" "C:\Program Files\Unity5.3.3\Editor\Data\PlaybackEngines\WebGLSupport/BuildTools/Emscripten/emcc" -Oz -std=c++11 -Wno-unused-value -Wno-invalid-offsetof -I-I"C:/design-app/Assets/../Temp/StagingArea/Data\Libraries\bdwgc/include" -I"C:/design-app/Assets/../Temp/StagingArea/Data\Libraries\libil2cpp/include" -I"C:/design-app/Assets/../Temp/StagingArea/Data\il2cppOutput" -nostdinc -DIL2CPP_EXCEPTION_DISABLED=1 -c @"C:\Users\xxx\AppData\Local\Temp\tmp29ac6c97.tmp"

    WARNING root: did not see a source tree above or next to the LLVM root directory (guessing based on directory of C:\Program Files\Unity5.3.3\Editor\Data\PlaybackEngines\WebGLSupport/BuildTools/Emscripten_FastComp_Win\llc), could not verify version numbers match
    INFO root: (Emscripten: Running sanity checks)
    WARNING root: java does not seem to exist, required for closure compiler, which is optional (define JAVA in ~/.emscripten if you want it)
    WARNING root: -I or -L of an absolute path "-IC:/design-app/Assets/../Temp/StagingArea/Data\Libraries\libil2cpp/include" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript). Pass '-Wno-warn-absolute-paths' to emcc to hide this warning.
    C:/design-app/Assets/../Temp/StagingArea/Data\il2cppOutput\Bulk_Assembly-UnityScript_6.cpp:33320:3: error: no matching function for call to 'ObjectManager_HideObjects_m1233987725'
    ObjectManager_HideObjects_m1233987725(__this, L_79, /*hidden argument*/NULL);
     
  2. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,123
    Anyone? Webgl still a problem for larger projects?
     
  3. alexsuvorov

    alexsuvorov

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    327
    Hello andyz.

    Could you create a bug report for this issue with your project attached? Please post the case number here.
     
  4. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,123
    This is actually a bug when you cast a List<InheritingClass> to List<BaseClass> it seems.
    Perhaps a rarity, but works outside of webgl!
    Minimal example provided: case 787600
     
  5. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,123
    This actually seems to be a js oddity as in C# you can not cast from one List type to another in the same way. So not an issue that is gonna come up often - probably why it hasn't been handled
     
  6. alexsuvorov

    alexsuvorov

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    327
    This is correct. In C# variance for List is not allowed. Although it seems to work in UnityScript, I believe it is also not allowed by il2cpp. The reason for this is the following:
    Code (JavaScript):
    1. function Start ()
    2. {
    3.    var list:List.<TestClass> = new List.<TestClass>();
    4.    Test(list);
    5. }
    6.  
    7. public class AnotherTestClass extends BaseTestClass
    8. {
    9. }
    10.  
    11. function Test(list:List.<BaseTestClass>)
    12. {
    13.    var btc:AnotherTestClass = new AnotherTestClass();
    14.    list.Add(btc);
    15. }
    Although this code will not generate any compile errors, it will cause the following runtime error on list.Add(btc):
    ArrayTypeMismatchException: Source array type cannot be assigned to destination array type.
    Because the list of TestClass can not contain an element of AnotherTestClass.

    In some situations it might be sufficient for you to create a list of casted elements to make the code work, the same way as you would do in C#:
    Code (JavaScript):
    1. import System.Linq;
    2.  
    3. Test(list.Cast.<BaseTestClass>().ToList());
    Additional information regarding this case will be provided in the bug report.
     
    andyz likes this.