WebGL Build Fails with FileNotFoundError in emar.py Due to Missing llvm-ar.exe (Unity 6000.1.0f1)

I’m encountering a persistent issue when building my project for WebGL in Unity 6000.1.0f1. The build fails with a

FileNotFoundError: [WinError 2] The system cannot find the file specified from emar.py

specifically when creating il2cpp.a. I’ve identified that llvm-ar.exe is missing from the Emscripten llvm directory. I’d appreciate any insights or solutions from the community.

Details of the Issue:

  • Unity Version: 6000.1.0f1 (experimental)
  • Platform: WebGL
  • Project Path: (e.g., a local project directory)
  • Unity Installation Path: (e.g., a standard Unity Hub installation path)
  • Error Output:
Building Library\Bee\artifacts\WebGL\il2cpp\master_WebGL_wasm\il2cpp.a failed with output:

<ProjectPath>>set MYDIR=<UnityEditorPath>\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\

<ProjectPath>>goto FOUND_MYDIR 
Traceback (most recent call last):
  File "<UnityEditorPath>\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\emar.py", line 37, in <module>
    sys.exit(shared.run_process(cmd, stdin=sys.stdin, check=False).returncode)
  File "<UnityEditorPath>\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten\tools\shared.py", line 115, in run_process
    ret = subprocess.run(cmd, check=check, input=input, *args, **kw)
  File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\subprocess.py", line 472, in run
  File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\subprocess.py", line 775, in __init__
  File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\subprocess.py", line 1178, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified

Key Observations:

  • Missing llvm-ar.exe:
    The Emscripten llvm directory (\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\llvm) contains tools like clang.exe, wasm-ld.exe, and llvm-as.exe, but llvm-ar.exe is missing.

I believe this is why emar.py fails, as it relies on llvm-ar.exe to create archive files like il2cpp.a.

Hi!

I just downloaded Unity 6000.1.0f1 through the Hub on Windows 10 and llvm-ar.exe is present in Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\llvm. Can you try to reinstall Unity through the Hub and see if the bug persists?

Hmmm … Antivirus perhaps not taking a liking to “potentially harmful” developer tools? It may have removed or quarantined that file.

If disabling antivirus and reinstalling brings the file back, and then running a scan on that install folder triggers the AV I’d like to know what it is. Some of the AVs employ a bittersweet strategy of “we gotta sell people why they need to still pay for our software when Windows Defender is THAT good”. I won’t name names because that’s pretty much all of them. :grin:

it maybe that an AV which has eaten the file, wont put it back if killed off.. you may need to make it put it back