Search Unity

Question Can't Build WebGL when can do on other platform

Discussion in 'Web' started by s6010808, Feb 15, 2021.

  1. s6010808

    s6010808

    Joined:
    Mar 27, 2020
    Posts:
    6
    Hi, i will try explain in short and informative.
    Does anyone know how to fix failed when build in WebGL? any response would be appreciated!

    -I used unity 2020.2.x and i can build .exe for play on windows with no problem.
    -when i try Switch and build in WebGL i got
    "Exception: Unity.IL2CPP.Building.BuilderFailedException: Traceback"
    and tell me something wrong about Emscripten and few python file(like, emcc.py,etc).
    for full error detail please take a look text file i attached.

    yesterday,I took a whole day try google and fix but i can't
    things i try so far:
    - reinstall unity and retry -> failed
    - downgrade for few version like 2020.1.x -> failed
    - change unity to run as administrator -> failed
    - change build directory to C: and other drive -> failed
    - check my path is no non-latin character -> failed
    - check the path that file exists and yes it is -> failed
    - even try to build new project with just 1 cube Still failed! (same error just different path)
    - and so much many thing i can't remember >x<".
    actually, it not necessary now to build as WebGL platform i but i just want to fix it. also it's good to know how to fix for my future project.

    ------------if you don't want to click the file then this below-----------
    Exception: Unity.IL2CPP.Building.BuilderFailedException: Traceback (most recent call last):
    File "X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc.py", line 3063, in <module>
    sys.exit(run())
    File "X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc.py", line 1521, in run
    compile_source_file(i, input_file)
    File "X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc.py", line 1513, in compile_source_file
    if run_process(args, check=False).returncode != 0:
    File "X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\tools\shared.py", line 167, in run_process
    return run_base(cmd, universal_newlines=universal_newlines, check=check, *args, **kw)
    File "X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\tools\shared.py", line 158, in run_base
    proc = Popen(cmd, *args, **kw)
    File "X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\lib\subprocess.py", line 711, in __init__
    errread, errwrite)
    File "X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\lib\subprocess.py", line 948, in _execute_child
    startupinfo)
    WindowsError: [Error 2] The system cannot find the file specified


    Invocation was: Executable: "X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe"
    Arguments: -E "X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\em++" -Wno-unused-value -Wno-invalid-offsetof -nostdinc -fno-strict-overflow -Wno-null-conversion -std=c++11 -O3 -Oz -DIL2CPP_EXCEPTION_DISABLED=1 -DNET_4_0 -DUNITY_AOT -DIL2CPP_MONO_DEBUGGER_DISABLED -DGC_NOT_DLL -DRUNTIME_IL2CPP -DBASELIB_INLINE_NAMESPACE=il2cpp_baselib -DNDEBUG -I"X:\Unity\2020.2.4f1\Editor\Data\il2cpp\libil2cpp" -I"X:\Unity\2020.2.4f1\Editor\Data\il2cpp\libil2cpp" -I"X:\Unity\2020.2.4f1\Editor\Data\il2cpp\external\bdwgc\include" -I"X:\Unity\2020.2.4f1\Editor\Data\il2cpp\external\xxHash" -I"X:\Unity\2020.2.4f1\Editor\Data\il2cpp\external\baselib\Include" -I"X:\Unity\2020.2.4f1\Editor\Data\il2cpp\external\baselib\Platforms\WebGL\Include" -I"X:\Unity\2020.2.4f1\Editor\Data\il2cpp\libil2cpp\pch" -I"X:\UnityProject\TestWebGL\Library\Il2cppBuildCache\WebGL\il2cppOutput" "X:\UnityProject\TestWebGL\Library\Il2cppBuildCache\WebGL\il2cppOutput\Il2CppCCalculateFieldValues.cpp" -o "X:\UnityProject\TestWebGL\Library\il2cpp_cache\88D4FB5475660F03317AD1FD1B3D06AB.o"

    at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable`1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector)
    at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
    at il2cpp.Compilation.CompilationDriver.Run(RuntimePlatform platform, BuildingOptions buildingOptions, ReadOnlyCollection`1 matchedAssemblyMethodSourceFiles)
    at il2cpp.Program.DoRun(String[] args, RuntimePlatform platform, BuildingOptions buildingOptions, Boolean throwExceptions)
    UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at <afa9f07022084fb2b65f56c776d2e220>:0)
    UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) (at <afa9f07022084fb2b65f56c776d2e220>:0)
    UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List`1[T] arguments, System.Action`1[T] setupStartInfo, System.String generatedCppOutputDirectory) (at <afa9f07022084fb2b65f56c776d2e220>:0)
    UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data, System.String outputDirectory, System.Boolean platformSupportsManagedDebugging) (at <afa9f07022084fb2b65f56c776d2e220>:0)
    UnityEditorInternal.IL2CPPBuilder.Run () (at <afa9f07022084fb2b65f56c776d2e220>:0)
    UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <afa9f07022084fb2b65f56c776d2e220>:0)
    UnityEditor.WebGL.WebGlBuildPostprocessor.CompileBuild (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:365)
    UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:910)
    UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <afa9f07022084fb2b65f56c776d2e220>:0)
    UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <afa9f07022084fb2b65f56c776d2e220>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)
     

    Attached Files:

  2. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    The error here seems to be

    WindowsError: [Error 2] The system cannot find the file specified


    Invocation was: Executable: "X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe"

    That is, Emscripten is unable to find python executable in that path. Can you confirm that it exists? I wonder if this is a somehow partial installation that occurred.
     
  3. s6010808

    s6010808

    Joined:
    Mar 27, 2020
    Posts:
    6
    Thank you for your response!
    I already did that and they all exist! sooo confused
    Please take a look on topic "things i try so far" above for more detail what i already try to fix:)

    upload_2021-2-17_11-39-45.png


    should i do clean reinstall?
     
  4. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Thanks for double checking, and sorry for missing the original confirmation in your first post.

    Actually, now that I look closer in the callstack, the issue is not that python would not be found. The code is already executing emcc.py using python, and it is emcc.py that is unable to execute a clang to compile a file.

    Some things that come to mind to test:

    1. If you repeat this set of commands, does that all look the same? (replace the directory with your path to Unity)

    commands.png

    2. Set the global persistent Windows Environment variable "EMCC_DEBUG=1" (not just a command prompt local set), e.g. see https://www.computerhope.com/issues/ch000549.htm for the dialog to find it. Then close Unity and Unity Hub, reopen and rebuild. Does that print more information to the log? In particular I am curious what the path name is that emcc.py prints out at line 1512 of emcc.py

    3. You are running 64-bit Windows, right? (you can double check with Windows+Pause -> System type: should read "64-bit Operating System). The compiler executables that are shipped for WebGL only support 64-bit OSes.
     
  5. s6010808

    s6010808

    Joined:
    Mar 27, 2020
    Posts:
    6
    here's the Result after I try according your 3 instruction..

    1. repeat set of commands it does look all the same.
    2. in the Windows Environment variable I can't find the variable "EMCC_DEBUG=1"
    3. Yes, I run 64 bit.

    furthermore, I wanna add up to you that I used to build WEBGL successfully before i used 2020.x.x

    and again Thank you for your support!
     
  6. s6010808

    s6010808

    Joined:
    Mar 27, 2020
    Posts:
    6
    To all who have same problem as mine.

    Only solution i found out now is "Build it On another computer"

    so i quite sure now it's not from my code or asset..

    anyway, i still need help here. and wanna know how to correctly fix this.

    any response would be appreciated!
     
  7. s6010808

    s6010808

    Joined:
    Mar 27, 2020
    Posts:
    6
    To all checking this post :

    I still have this problem and don't know other ways to fix it than above.

    any ideas?

    thx :)
     
  8. s6010808

    s6010808

    Joined:
    Mar 27, 2020
    Posts:
    6
    To all checking this post :

    sry for necro this thread but I still have this problem and don't know other ways to fix it than above.

    Please help me.

    thank you.
     
  9. Lextao

    Lextao

    Joined:
    Nov 4, 2018
    Posts:
    3
    I'm having this same issue, can we have some help, please?
     
  10. AndreiNikolaenko

    AndreiNikolaenko

    Joined:
    Oct 19, 2021
    Posts:
    1
    Also having the issue, can't build WebGL on Windows
     
  11. Phantom5533

    Phantom5533

    Joined:
    Jun 25, 2021
    Posts:
    3
    Or you may try to change the platform. Qform as an alternative can work better for you. Especially, if you are planning to create feedback polls for your users on your website.
     
  12. osmankaplan01

    osmankaplan01

    Joined:
    Feb 23, 2022
    Posts:
    1
    I am having the same problem. But on mac platform. I couldn't solve the problem :(