Getting System.ComponentModel.Win32Exception (2): No such file or directory

I’m getting this error when building from unity webgl.

macos monterey 12.3

M1 macbookpro

unity 2020.3.11f1

System.ComponentModel.Win32Exception (2): No such file or directory
at System.Diagnostics.Process.ForkAndExecProcess(String filename, String argv, String envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32 groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at Unity.IL2CPP.Shell.SetupAndStart(ExecuteContext context, Boolean asyncMode) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 423
at Unity.IL2CPP.Shell.ExecuteAsync(ExecuteArgs executeArgs, IExecuteController controller, Boolean asyncMode) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 299
at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 355
at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Building/CppProgramBuilder.cs:line 334
at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.b__0(Object o) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Building/ParallelFor.cs:line 78

TIA. I hope someone can help me with this.

This happened when I upgrade my macos to the latest.

Exact same issue here with a fresh brand new project. I've been searching for a solution for 2 days and no luck so far.

6 Answers

6

The solution has already been found: https://forum.unity.com/threads/case-1412113-builderror-osx-12-3-and-unity-2020-3-constant-build-errors.1255419/

If anyone is wondering what it is, the workaround is to install Python 2.7.

Unfortunately I’m also having the same issue.

M1 Pro Macbook Pro 14"
Monterey 12.3
Unity 2020.3.31f LTS

System.ComponentModel.Win32Exception (2): No such file or directory
   at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at Unity.IL2CPP.Shell.SetupAndStart(ExecuteContext context, Boolean asyncMode) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 423
   at Unity.IL2CPP.Shell.ExecuteAsync(ExecuteArgs executeArgs, IExecuteController controller, Boolean asyncMode) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 299
   at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 355
   at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Building/CppProgramBuilder.cs:line 334
   at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Building/ParallelFor.cs:line 78

Exact same issue here with a fresh brand new project. I’ve been searching for a solution for 2 days and no luck so far.

Hi,

I faced the same issue with the LTS versions. As I am using an M1 PRO 14" MacBook I gave a try to the latest official silicon editor - even if it is not an LTS - and it worked just fine.

OS: macOS Monterey 12.3
Unity Editor: 2021.2.16f1 Silicon

I hope this helps.

Jani

The problem is that upgrading version from 2020 to 2021 may bring issues and it's not that simple to upgrade a project.

Thank you all for the response. I tried the workaround on my project but it is not compatible or there is new error thrown when I update it in 2021.2.16f1.

If no luck or no fixes on this issue, It is better to do it on windows pc/laptop.

For those who face the issue on the Linux. I fixed it by adding the code provided by @M_R_Antonio but with some slight changes.

First install the python2 package if it doesn’t exits:

sudo apt install python2

Then you have to find your phyton2 location:

name@machine:~$ whereis python2
python2: /usr/bin/python2

After you change environment line to:

System.Environment.SetEnvironmentVariable("EMSDK_PYTHON", "/usr/bin/python2");

Surely your path can be different but most likely it’s gonna be the same.

After that I’ve encountered another lib dependency issue:

error while loading shared libraries: libtinfo.so.5

but I was able to fix it by installing libncurses5:

sudo apt install libncurses5

Hope that’s gonna help someone.