Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Cannot build in development mode

Discussion in 'WebGL' started by trumanita, Jun 7, 2019.

  1. trumanita

    trumanita

    Joined:
    Feb 2, 2012
    Posts:
    20
    version 2019.3.0a5

    I can build my project normally but not in development mode

    Failed running C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\il2cpp/build/il2cpp.exe --convert-to-cpp --emit-null-checks --enable-stacktrace --enable-array-bounds-check --dotnetprofile="unityaot" --compile-cpp --libil2cpp-static --platform="WebGL" --architecture="EmscriptenJavaScript" --configuration="Release" --outputpath="MYPATH\Assets /../Temp/StagingArea/Data\Native\build.bc" --cachedirectory="MYPATH\Assets\..\Library/il2cpp_cache" --compiler-flags="-Oz" --emit-method-map --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_AccessibilityModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_AIModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_AndroidJNIModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_AnimationModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_ARModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_AssetBundleModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_AudioModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_ClothModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_CoreModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_CrashReportingModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_DirectorModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_DSPGraphModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_GameCenterModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_GridModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_HotReloadModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_ImageConversionModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_IMGUIModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_InputLegacyModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_InputModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_JSONSerializeModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_LocalizationModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_ParticleSystemModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_PerformanceReportingModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_Physics2DModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_PhysicsModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_ProfilerModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_ScreenCaptureModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_SharedInternalsModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_SpriteMaskModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_SpriteShapeModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_StreamingModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_SubstanceModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_TerrainModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_TerrainPhysicsModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_TextCoreModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_TextRenderingModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_TilemapModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_TLSModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_UIElementsModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_UIModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_UmbraModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_UNETModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_UnityAnalyticsModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_UnityConnectModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_UnityTestProtocolModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_UnityWebRequestAssetBundleModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_UnityWebRequestAudioModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_UnityWebRequestModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_UnityWebRequestTextureModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_UnityWebRequestWWWModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_VehiclesModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_VFXModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_VideoModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_VRModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_WebGLModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_WindModule_Dynamic.bc" --additional-libraries="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/PlaybackEngines/WebGLSupport\BuildTools\lib\modules_development\WebGLSupport_XRModule_Dynamic.bc" --enable-debugger --profiler-report --map-file-parser="C:/Program Files/Unity/Hub/Editor/2019.3.0a5/Editor/Data/Tools/MapFileParser/MapFileParser.exe" --directory="C:/Users/giuseppei/OneDrive - Agic Technology srl/Documenti/Unity/MyGPViewer4.0/Temp/StagingArea/Data/Managed" --generatedcppdir="C:/Users/giuseppei/OneDrive - Agic Technology srl/Documenti/Unity/MyGPViewer4.0/Temp/StagingArea/Data/il2cppOutput"

    stdout:
    Building build.bc with EmscriptenToolChain
    Output directory: MYPATH\Temp\StagingArea\Data\Native
    Cache directory: MYPATH\Library\il2cpp_cache
    il2cpp.exe didn't catch exception: Unity.IL2CPP.Building.BuilderFailedException: In file included from MYPATH\Temp\StagingArea\Data\il2cppOutput\lumpedcpp\Lump_libil2cpp_os.cpp:7:
    MYPATH\Temp\StagingArea\Data\il2cppOutput\lumpedcpp/..\..\..\..\..\..\..\..\..\..\..\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\il2cpp\libil2cpp\os\Emscripten\SocketBridge.cpp:8:10: fatal error: 'emscripten/posix_socket.h' file not found
    #include <emscripten/posix_socket.h>
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    ERROR:root:compiler frontend failed to generate LLVM bitcode, halting


    Invocation was: Executable: "C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe"
    Arguments: -E "C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\em++" -Wno-unused-value -Wno-invalid-offsetof -nostdinc -fno-strict-overflow -Wno-null-conversion -std=c++11 -s USE_PTHREADS=1 -O3 -Oz -DNET_4_0 -DUNITY_AOT -DIL2CPP_MONO_DEBUGGER=1 -DIL2CPP_DEBUGGER_PORT=56000 -DPLATFORM_UNITY -DUNITY_USE_PLATFORM_STUBS -DENABLE_OVERRIDABLE_ALLOCATORS -DIL2CPP_ON_MONO=1 -DDISABLE_JIT=1 -DDISABLE_REMOTING=1 -DHAVE_CONFIG_H -DMONO_DLL_EXPORT=1 -DGC_NOT_DLL -DRUNTIME_IL2CPP -DNDEBUG -I"C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\il2cpp\libil2cpp" -I"C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\il2cpp\libil2cpp" -I"C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\il2cpp\external\bdwgc\include" -I"C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\il2cpp\external\xxHash" -I"C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\il2cpp\external\mono" -I"C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\il2cpp\external\mono\mono\eglib" -I"C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\il2cpp\external\mono\mono" -I"C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\il2cpp\external\mono\mono\sgen" -I"C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\il2cpp\external\mono\mono\utils" -I"C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\il2cpp\external\mono\mono\metadata" -I"C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\il2cpp\external\mono\mono\metadata\private" -I"C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\il2cpp\libil2cpp\os\c-api" -I"C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\il2cpp\libmono\config" "MYPATH\Temp\StagingArea\Data\il2cppOutput\lumpedcpp\Lump_libil2cpp_os.cpp" -o "MYPATH\Library\il2cpp_cache\libil2cpp\B9B59419A7EA6753C312FB9A0E581DC3.o"

    in Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable`1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector)
    in Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
    in il2cpp.Program.DoRun(String[] args)
    in il2cpp.Program.Run(String[] args)
    in il2cpp.Program.Main(String[] args)
    stderr:

    Eccezione non gestita: Unity.IL2CPP.Building.BuilderFailedException: In file included from MYPATH\Temp\StagingArea\Data\il2cppOutput\lumpedcpp\Lump_libil2cpp_os.cpp:7:
    MYPATH\Temp\StagingArea\Data\il2cppOutput\lumpedcpp/..\..\..\..\..\..\..\..\..\..\..\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\il2cpp\libil2cpp\os\Emscripten\SocketBridge.cpp:8:10: fatal error: 'emscripten/posix_socket.h' file not found
    #include <emscripten/posix_socket.h>
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    ERROR:root:compiler frontend failed to generate LLVM bitcode, halting


    Invocation was: Executable: "C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe"
    Arguments: -E "C:\Program Files\Unity\Hub\Editor\2019.3.0a5\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscript<message truncated>
     
  2. DrViJ

    DrViJ

    Joined:
    Feb 9, 2013
    Posts:
    31
    Hello, I had the same problem today (fatal error: 'emscripten/posix_socket.h' file not found), Unity 2019.2.0f. It helped me to clear Library and temp folder of the project, start unity and build again. the build succeed
     
  3. Roywise

    Roywise

    Joined:
    Jun 1, 2017
    Posts:
    68
    We're currently having the same issue, after updating to Unity 2019.2.4f1 from Unity 2018.3.11f1, and I will try the possible solution that @DrViJ suggested.

    Update: After removing the Library and obj folder the same issue still occurs.

    Part of the Editor log.
    Code (CSharp):
    1. stdout:
    2. Building build.bc with EmscriptenToolChain
    3.     Output directory: D:\Codebases\unity-presenter-webgl\Temp\StagingArea\Data\Native
    4.     Cache directory: D:\Codebases\unity-presenter-webgl\Library\il2cpp_cache
    5. il2cpp.exe didn't catch exception: Unity.IL2CPP.Building.BuilderFailedException: In file included from D:\Codebases\unity-presenter-webgl\Temp\StagingArea\Data\il2cppOutput\lumpedcpp\Lump_libil2cpp_os.cpp:7:
    6. C:\Program Files\Unity\Hub\Editor\2019.2.4f1\Editor\Data\il2cpp\libil2cpp\os\Emscripten\SocketBridge.cpp:8:10: fatal error: 'emscripten/posix_socket.h' file not found
    7. #include <emscripten/posix_socket.h>
    @JoshPeterson Do you have suggestions?
     
    Last edited: Sep 17, 2019
  4. lweehuizen-imb

    lweehuizen-imb

    Joined:
    Jun 12, 2018
    Posts:
    1
    I'm having the same issue when going from 2018.3.14 to 2019.2.9. Did you ever find a solution?

    I suppose I could step back one point release at a time, but I expect the same results.
     
  5. Bramverhoeven2

    Bramverhoeven2

    Joined:
    Dec 5, 2017
    Posts:
    3
    We had the same issue when we used the following BuildOptions:
    BuildOptions options = BuildOptions.AllowDebugging | BuildOptions.Development


    When we removed the BuildOptions.AllowDebugging it was working again.
     
  6. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,157
    Facing this same issue on Linux when building for WebGL in development mode. 2019.2.5f1.

    Anyone found a fix?


    Edit: I found a fix, but it's wierd. While WebGL is the selected target. I select Standalone and uncheck script debugging there. Somehow that affects WebGL even though it's a different target.
     
    DannyWebbie likes this.
  7. EdRowlett-Barbu

    EdRowlett-Barbu

    Joined:
    Mar 16, 2015
    Posts:
    88
    Also have this issue with 2019.3.0f5, solutions please?
    Having this exact issue, building using scriptable pipeline, webgl debug target. I can't debug my build because of this, huge blocker. The scripting debugging checkbox is disabled so couldn't do the fix above.
    Any solutions?
     
  8. ANTONBORODA

    ANTONBORODA

    Joined:
    Nov 16, 2017
    Posts:
    9
    Same issue with 2019.3.13. Any solution for this?
     
  9. huulong

    huulong

    Joined:
    Jul 1, 2013
    Posts:
    62
    It seems like only WebGL dev build is passing `-s USE_PTHREADS=1` which in turn requires threading.h and posix_socket.h. I checked the folder Unity/Hub/Editor/2019.3.10f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/system/include/emscripten and it contains threading.h but not posix_socket.h

    Reference: https://emscripten.org/docs/porting/pthreads.html

    So I checked the version in PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emscripten-version.txt and it is "1.38.11". A look at emscripten's repo shows that 1.38.11 indeed doesn't have posix_socket.h, it was added in a big socket-related commit and can only be found in 1.39.5+

    https://github.com/emscripten-core/emscripten/tree/1.38.11/system/include/emscripten
    https://github.com/emscripten-core/emscripten/tree/1.39.5/system/include/emscripten
    https://github.com/emscripten-core/emscripten/commit/31309a8c12aaf142ec483dbe3edc0aa195c1bbca

    So basically, Unity's il2cpp SocketBridge is using a feature from a version of emscripten more advanced than the one distributed with Unity 2019.3.10.

    Unity/Hub/Editor/2019.3.10f1/Editor/Data/il2cpp/libil2cpp/os/Emscripten/SocketBridge.cpp

    Code (CSharp):
    1. #include "il2cpp-config.h"
    2.  
    3. #if IL2CPP_TARGET_JAVASCRIPT
    4. #include "os/SocketBridge.h"
    5.  
    6. #ifdef __EMSCRIPTEN_PTHREADS__
    7. #include <emscripten/threading.h>
    8. #include <emscripten/posix_socket.h>
    9. #endif // __EMSCRIPTEN_PTHREADS__
    10.  
    11. namespace il2cpp
    12. {
    13. namespace os
    14. {
    15.     void SocketBridge::WaitForInitialization()
    16.     {
    17. #ifdef __EMSCRIPTEN_PTHREADS__
    18.         EMSCRIPTEN_WEBSOCKET_T bridgeSocket = emscripten_init_websocket_to_posix_socket_bridge("ws://localhost:6690");
    19.         // Synchronously wait until connection has been established
    20.         uint16_t readyState = 0;
    21.         do
    22.         {
    23.             emscripten_websocket_get_ready_state(bridgeSocket, &readyState);
    24.             emscripten_thread_sleep(100);
    25.         }
    26.         while (readyState == 0);
    27. #endif // __EMSCRIPTEN_PTHREADS__
    28.     }
    29. }
    30. }
    31.  
    32. #endif // IL2CPP_TARGET_JAVASCRIPT
    I will report a bug to Unity with this information.
     
    Last edited: Jun 16, 2020
  10. huulong

    huulong

    Joined:
    Jul 1, 2013
    Posts:
    62
    I submitted the bug report and pointed them to this thread.
     
  11. Wyntersoft

    Wyntersoft

    Joined:
    Jul 29, 2020
    Posts:
    1
    Still occurring in 2020.1
     
unityunity