WebGL Build error Exception: Unity.IL2CPP.Building.BuilderFailedException: ERROR:root:compiler front

Hi,
I was building a microgame for educational purposes, and made a WebGL build with Unity Editor 2020.3.26f1 personal .
It didn’t build and showed this error. I saw multiple threads/discussions for WebGL errors but none was helpful for me. So, I am posting my own error here, in hopes to get solution for this. This WebGL build didn’t work in previous version of Unity Editor 2020.3.4f1 for any projects, so i thought it was editor problem which it isn’t i think.

Console error 1:

Exception: Unity.IL2CPP.Building.BuilderFailedException: ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
Invocation was: Executable: “C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe”
Arguments: -E “C:\Program Files\Unity\Hub\Editor\2020.3.26f1\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"C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\il2cpp\libil2cpp" -I"C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\il2cpp\libil2cpp" -I"C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\il2cpp\external\bdwgc\include" -I"C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\il2cpp\external\xxHash" -I"C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\il2cpp\external\baselib\Include" -I"C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\il2cpp\external\baselib\Platforms\WebGL\Include" -I"C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\il2cpp\libil2cpp\pch" -I"C:\Users\Lenovo\Unity Projects\Surface Reflection microgame\Library\Il2cppBuildCache\WebGL\il2cppOutput" “C:\Users\Lenovo\Unity Projects\Surface Reflection microgame\Library\Il2cppBuildCache\WebGL\il2cppOutput\mscorlib9.cpp” -o “C:\Users\Lenovo\Unity Projects\Surface Reflection microgame\Library\il2cpp_cache\885F9C30E35E2C39D74C45A02255448F.o”
at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector) at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics) at il2cpp.Compilation.CompilationDriver.Run(RuntimePlatform platform, BuildingOptions buildingOptions, ReadOnlyCollection1 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 <55729f52d042492e9efc384182ae2feb>:0)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action1[T] setupStartInfo) (at <55729f52d042492e9efc384182ae2feb>:0) UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List1[T] arguments, System.Action1[T] setupStartInfo) (at <55729f52d042492e9efc384182ae2feb>:0) UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data) (at <55729f52d042492e9efc384182ae2feb>:0) UnityEditorInternal.IL2CPPBuilder.Run () (at <55729f52d042492e9efc384182ae2feb>:0) UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <55729f52d042492e9efc384182ae2feb>: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:913)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <55729f52d042492e9efc384182ae2feb>: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 <55729f52d042492e9efc384182ae2feb>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Console error 2:

Build completed with a result of ‘Failed’ in 123 seconds (123302 ms)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Console error 3:

UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <55729f52d042492e9efc384182ae2feb>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <55729f52d042492e9efc384182ae2feb>:0
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Console error 4:

[Version and Build] Build failed! 00:02:03.3016934
UnityEngine.Debug:LogError (object)
Unity.Play.Publisher.Editor.PublisherBuildProcessor/d__7:MoveNext () (at Library/PackageCache/com.unity.connect.share@4.2.3/Editor/PublisherBuildProcessor.cs:77)
Unity.EditorCoroutines.Editor.EditorCoroutine/YieldProcessor:MoveNext (System.Collections.IEnumerator) (at Library/PackageCache/com.unity.editorcoroutines@1.0.0/Editor/EditorCoroutine.cs:80)
Unity.EditorCoroutines.Editor.EditorCoroutine:ProcessIEnumeratorRecursive (System.Collections.IEnumerator) (at Library/PackageCache/com.unity.editorcoroutines@1.0.0/Editor/EditorCoroutine.cs:134)
Unity.EditorCoroutines.Editor.EditorCoroutine:MoveNext () (at Library/PackageCache/com.unity.editorcoroutines@1.0.0/Editor/EditorCoroutine.cs:115)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

[It is a bit urgent for me to create a WebGL build, it is intern work related. Windows build works fine but those are not accepted.]

Thanks for your time.

The logs aren’t really helpful. Is there more in Editor.log perhaps?

Just a hunch: I would check for anything that isn’t WebGL compatible, specifically plugins or use of “unsafe” code or unsupported .NET libraries and things like that.

[I am beginner-intermediate (ish) level unity dev.]
There are only these four logs in Console of this project. And how to check those, not compatible libraries or plugins or safe code. (Didn’t use much of these things in this project I have 2 scripts one for camera one for event manager.)

For sake any incompatible things, i tried to make a new/empty project with nothing in it and tried WebGL build and windows build both.

Windows Build : works fine

WebGL Build : Again Error →

Empty template Unity Editor 2020.3.26f1 personal WebGL Build

Error log

Console log 1:

Exception: Unity.IL2CPP.Building.BuilderFailedException: ERROR:root:compiler frontend failed to generate LLVM bitcode, halting
Invocation was: Executable: “C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe”
Arguments: -E “C:\Program Files\Unity\Hub\Editor\2020.3.26f1\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"C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\il2cpp\libil2cpp" -I"C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\il2cpp\libil2cpp" -I"C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\il2cpp\external\bdwgc\include" -I"C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\il2cpp\external\xxHash" -I"C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\il2cpp\external\baselib\Include" -I"C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\il2cpp\external\baselib\Platforms\WebGL\Include" -I"C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\il2cpp\libil2cpp\pch" -I"C:\Users\Lenovo\Unity\My project\Library\Il2cppBuildCache\WebGL\il2cppOutput" “C:\Users\Lenovo\Unity\My project\Library\Il2cppBuildCache\WebGL\il2cppOutput\mscorlib10.cpp” -o “C:\Users\Lenovo\Unity\My project\Library\il2cpp_cache\CF3306723D3ED7C35D9469E45D1AE510.o”
at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector) at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics) at il2cpp.Compilation.CompilationDriver.Run(RuntimePlatform platform, BuildingOptions buildingOptions, ReadOnlyCollection1 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 <55729f52d042492e9efc384182ae2feb>:0)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action1[T] setupStartInfo) (at <55729f52d042492e9efc384182ae2feb>:0) UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List1[T] arguments, System.Action1[T] setupStartInfo) (at <55729f52d042492e9efc384182ae2feb>:0) UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data) (at <55729f52d042492e9efc384182ae2feb>:0) UnityEditorInternal.IL2CPPBuilder.Run () (at <55729f52d042492e9efc384182ae2feb>:0) UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <55729f52d042492e9efc384182ae2feb>: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:913)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <55729f52d042492e9efc384182ae2feb>: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 <55729f52d042492e9efc384182ae2feb>:0)
UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)

Console log 2:

Build completed with a result of ‘Failed’ in 298 seconds (298048 ms)
UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

Console log 3:

UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <55729f52d042492e9efc384182ae2feb>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <55729f52d042492e9efc384182ae2feb>:0
UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

Thank you for your time

Tried reinstalling every single software but nothing worked. Finally reinstalled windows itself with all files intact. Then after reinstallation of unity and visual studios it worked.

For information, It came again not a solution. It works for one build and comes again.
That’s what what I thought when I received this error again but after opening and closing unity editor and after few hours it worked again( the WebGL build).

Hey buddy,
I finally found solution to it. Idk if reinstalling windows helped or not but after reinstalling windows when this error appear, is only when my default browser on which unity would play the game, still has a tab or window open.
Closing it worked, it didn’t show error after closing browser and reopening unity.