IL2CPP error errors when trying to build apk.

Can anyone help. Im quite a novice and have run into this error. It plays fine in the player and everything works but when i try ti build the apk for the oculus quest, i get the following errors. Its only a basic 3 scene app with a walk through of some environments using photon.

IL2CPP error for method ‘System.Void POpusCodec.OpusDecoderAsync`1::smile:ataCallbackStatic(System.IntPtr,System.IntPtr,System.Int32,System.Boolean)’ in OpusDecoder.cs:155
Additional information: Specified argument was out of the range of valid values.

Failed running C:\Program Files\Unity\Hub\Editor\2019.4.9f1\Editor\Data\il2cpp/build/deploy/net471/il2cpp.exe --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile=“unityaot” --compile-cpp --libil2cpp-static --platform=“Android” --architecture=“ARMv7” --configuration=“Release” --outputpath=“E:\Virtual shop\shop1\multplayer - Copy\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a\libil2cpp.so” --cachedirectory=“E:\Virtual shop\shop1\multplayer - Copy\Assets..\Library\il2cpp_android_armeabi-v7a/il2cpp_cache” --additional-include-directories=“C:/Program Files/Unity/Hub/Editor/2019.4.9f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\bdwgc/include” --additional-include-directories=“C:/Program Files/Unity/Hub/Editor/2019.4.9f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\libil2cpp/include” --tool-chain-path=“C:/Program Files/Unity/Hub/Editor/2019.4.9f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK” --profiler-report --map-file-parser=“C:/Program Files/Unity/Hub/Editor/2019.4.9f1/Editor/Data/Tools/MapFileParser/MapFileParser.exe” --directory=“E:/Virtual shop/shop1/multplayer - Copy/Temp/StagingArea/assets/bin/Data/Managed” --generatedcppdir=“E:/Virtual shop/shop1/multplayer - Copy/Temp/StagingArea/Il2Cpp/il2cppOutput”
stdout:
IL2CPP error for method 'System.Void POpusCodec.OpusDecoderAsync1::smile:ataCallbackStatic(System.IntPtr,System.IntPtr,System.Int32,System.Boolean)' in E:\Virtual shop\shop1\multplayer - Copy\Assets\Photon\PhotonVoice\PhotonVoiceApi\Core\POpusCodec\OpusDecoder.cs:155 Additional information: Specified argument was out of the range of valid values. il2cpp.exe didn't catch exception: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. at Mono.Collections.Generic.Collection1.get_Item(Int32 index)
at Unity.IL2CPP.ILPreProcessor.TypeResolver.Resolve(TypeReference typeReference, Boolean resolveGenericParameters)
at Unity.IL2CPP.ILPreProcessor.TypeResolver.Resolve(TypeReference typeReference, Boolean resolveGenericParameters)
at Unity.IL2CPP.Marshaling.BodyWriters.NativeToManaged.ReversePInvokeMethodBodyWriter.GetInteropMethod(MethodReference method)
at Unity.IL2CPP.Marshaling.BodyWriters.NativeToManaged.ReversePInvokeMethodBodyWriter.Create(MethodReference managedMethod)
at Unity.IL2CPP.SourceWriter.WriteMarshalingDefinitions(IGeneratedMethodCodeWriter writer, TypeReference type, IInteropDataCollector interopDataCollector)
at Unity.IL2CPP.SourceWriter.WriteEqualSizedChunks[T](NPath outputDir, IEnumerable1 items, String fileName, Int64 chunkSize, Action1 writeHeaderAction, Action2 writeItemAction, Action1 writeFooterAction, SourceWritingContext sourceWritingContext, Action2 writeEnd) at Unity.IL2CPP.SourceWriter.WriteEqualSizedChunks[T](NPath outputDir, IEnumerable1 items, String fileName, Int64 chunkSize, Action2 writeItemAction, SourceWritingContext sourceWritingContext, Action2 writeEnd)
at Unity.IL2CPP.SourceWriter.WriteGenericComDefinitions(NPath outputDirectory, ReadOnlyInflatedCollectionCollector genericsCollectionCollector, SourceWritingContext sourceWritingContext)
at Unity.IL2CPP.SourceWriter.<>c__DisplayClass1_0.b__2()
at Unity.IL2CPP.Common.ParallelHelper.ForEach[TSource](IEnumerable1 source, Action1 action, Func2 shouldForceSerialCallback, Boolean loadBalance, Boolean betaTag) at Unity.IL2CPP.ParallelHelper.ForEach[TSource](IEnumerable1 source, Action1 action, Boolean loadBalance, Boolean betaTag) at Unity.IL2CPP.AssemblyConverter.Apply() at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies(IEnumerable1 assemblyDirectories, IEnumerable1 explicitAssemblies, NPath outputDir, NPath dataFolder, NPath symbolsFolder, NPath executableAssembiesFolder, NPath monoLibFolder, NPath monoEtcFolder, NPath[ ] searchDirectories, String entryAssemblyName, NPath[ ] extraTypesFiles) at il2cpp.Program.DoRun(String[ ] args, List1 foundAssemblies)
at il2cpp.Program.Run(String[ ] args, Boolean setInvariantCulture)
at il2cpp.Program.Main(String[ ] args)
stderr:
Unhandled Exception: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
at Mono.Collections.Generic.Collection1.get_Item(Int32 index) at Unity.IL2CPP.ILPreProcessor.TypeResolver.Resolve(TypeReference typeReference, Boolean resolveGenericParameters) at Unity.IL2CPP.ILPreProcessor.TypeResolver.Resolve(TypeReference typeReference, Boolean resolveGenericParameters) at Unity.IL2CPP.Marshaling.BodyWriters.NativeToManaged.ReversePInvokeMethodBodyWriter.GetInteropMethod(MethodReference method) at Unity.IL2CPP.Marshaling.BodyWriters.NativeToManaged.ReversePInvokeMethodBodyWriter.Create(MethodReference managedMethod) at Unity.IL2CPP.SourceWriter.WriteMarshalingDefinitions(IGeneratedMethodCodeWriter writer, TypeReference type, IInteropDataCollector interopDataCollector) at Unity.IL2CPP.SourceWriter.WriteEqualSizedChunks[T](NPath outputDir, IEnumerable1 items, String fileName, Int64 chunkSize, Action1 writeHeaderAction, Action2 writeItemAction, Action1 writeFooterAction, SourceWritingContext sourceWritingContext, Action2 writeEnd)
at Unity.IL2CPP.SourceWriter.WriteEqualSizedChunks[T](NPath outputDir, IEnumerable1 items, String fileName, Int64 chunkSize, Action2 writeItemAction, SourceWritingContext sourceWritingContext, Action2 writeEnd) at Unity.IL2CPP.SourceWriter.WriteGenericComDefinitions(NPath outputDirectory, ReadOnlyInflatedCollectionCollector genericsCollectionCollector, SourceWritingContext sourceWritingContext) at Unity.IL2CPP.SourceWriter.<>c__DisplayClass1_0.<WriteGenerics>b__2() at Unity.IL2CPP.Common.ParallelHelper.ForEach[TSource](IEnumerable1 source, Action1 action, Func2 shouldForceSerialCallback, Boolean loadBalance, Boolean betaTag)
at Unity.IL2CPP.ParallelHelper.ForEach[TSource](IEnumerable1 source, Action1 action, Boolean loadBalance, Boolean betaTag)
at Unity.IL2CPP.AssemblyConverter.Apply()
at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies(IEnumerable1 assemblyDirectories, IEnumerable1 explicitAssemblies, NPath outputDir, NPath dataFolder, NPath symbolsFolder, NPath executableAssembiesFolder, NPath monoLibFolder, NPath monoEtcFolder, NPath[ ] searchDirectories, String entryAssemblyName, NPath[ ] extraTypesFiles)
at il2cpp.Program.DoRun(String[ ] args, List1 foundAssemblies) at il2cpp.Program.Run(String[ ] args, Boolean setInvariantCulture) at il2cpp.Program.Main(String[ ] args) UnityEngine.Debug:LogError(Object) UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase) UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action1)
UnityEditorInternal.IL2CPPBuilder:RunIl2CppWithArguments(List1, Action1, String)
UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(Il2CppBuildPipelineData, String, String, Boolean)
UnityEditorInternal.IL2CPPBuilder:Run()
UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Exception: C:\Program Files\Unity\Hub\Editor\2019.4.9f1\Editor\Data\il2cpp/build/deploy/net471/il2cpp.exe did not run properly!
UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at :0)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action1[T] setupStartInfo) (at <d3ff43e972b043d1b3f49905ec5da738>:0) UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List1[T] arguments, System.Action1[T] setupStartInfo, System.String workingDirectory) (at <d3ff43e972b043d1b3f49905ec5da738>:0) UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data, System.String outputDirectory, System.String workingDirectory, System.Boolean platformSupportsManagedDebugging) (at <d3ff43e972b043d1b3f49905ec5da738>:0) UnityEditorInternal.IL2CPPBuilder.Run () (at <d3ff43e972b043d1b3f49905ec5da738>:0) UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at :0)
UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <2975258ba72b4441a1487a1bed69dfb8>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <2975258ba72b4441a1487a1bed69dfb8>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <2975258ba72b4441a1487a1bed69dfb8>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <2975258ba72b4441a1487a1bed69dfb8>: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 :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Build completed with a result of ‘Failed’ in 584 seconds (584452 ms)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

UnityEditor.BuildPlayerWindow+BuildMethodException: 4 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002bb] in :0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in :0
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

This appears to be failing to build in the Photon Voice package. You might consider copying your project and removing it to test a build, and/or I would recommend contacting the package authors.

I have a similar error trying to build for webGL if you could help. Here is the error:

Failed running /Applications/Unity/Hub/Editor/2020.1.6f1/Unity.app/Contents/il2cpp/build/deploy/net471/il2cpp.exe --convert-to-cpp --dotnetprofile=“unityaot” --compile-cpp --libil2cpp-static --platform=“WebGL” --architecture=“EmscriptenJavaScript” --configuration=“Release” --outputpath=“/Users/…/Unity/Assets /…/Temp/StagingArea/Data/Native/build.bc” --cachedirectory=“/Users/…/Unity/Assets/…/Library/il2cpp_cache” --compiler-flags=“-Oz -DIL2CPP_EXCEPTION_DISABLED=1 " --baselib-directory=”/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/Variations/development" --avoid-dynamic-library-copy --emit-method-map --additional-libraries=“/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/lib/modules_development/WebGLSupport_AIModule_Dynamic.bc”

There should be additional information in the editor log (or maybe the editor console) about this error message. This part of the message is pretty general, and does not let us know what caused the error.

Could to track down that additional information and post it here?

9058819–1252426–UnityLog.txt (142 KB)

It looks like there might be a problem locating or running python on this machine, which is required to run the Emscripten C++ compiler.

Does /usr/bin/python exist and work on this machine?

Thanks for looking into this!

It doesn’t exist on usr/bin nor is it default directory with new versions of mac OS as it is a security issue. I tried creating a sym link without success. Can I change target location from Unity somehow?

In Unity < 2021.2 (iirc if I am not messing up my memory on the versions), Unity used to rely on Apple to ship Python as part of macOS. Like Josh mentions above, /usr/bin/python is one of the paths that is looked up, and also iirc anything in PATH should be looked for as last resort.

In Unity 2021.2, with Emscripten 2.0.19.6-unity, Emscripten updated to Python 3, and we migrated to bundling Python 3 as part of the WebGL package, which fixed Unity to no longer depend on macOS system python.

In Unity 2022.2, Unity updated to Emscripten 3.1.8-unity, which streamlined the Emscripten SDK installation with WebGL package.

Apple dropped shipping built-in Python 2 in a newer OS update macOS 11.0 (iirc?) when Apple M1 chips came out, which broke Unity < 2021.2 to no longer be able to build to WebGL out of the box on macOS.

To fix that issue, Unity retrofitted the Emscripten installations on Unity < 2021.2 to also explicitly ship Python, but I am not 100% on which Unity versions have that backport fix. Should be in all tech streams, but maybe there was a gap somewhere.

So to troubleshoot, try testing Unity 2022.2 and then Unity 2021.2. If those work for you out of the box, then it is likely the issue is about missing bundled python. If those don’t work either, then the issue is probably something else that is a bit more subtle.

You can also try doing a subdirectory search inside the Unity Editor directory, and see if there is a ‘python’ executable in there to see if your particular version of Unity has come with a bundled python, or if it is expecting a system installed version. If you haven’t already, updating to latest point release of your editor tech stream might also help.

Thanks for all this info. I followed the advice to add a prebuild scrip from https://discussions.unity.com/t/875449 and now I’m getting issue below:

Failed running /Library/Frameworks/Python.framework/Versions/2.7/bin/python -E “/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emcc” @“/Users/someUser/Documents/Unity/Projects/unity2/UI/Unity/Assets/…/Temp/emcc_arguments.resp”

stdout:
stderr:[0;33mwarning:[0m unexpected number of arguments 1 in call to ‘__cxa_pure_virtual’, should be 0[0;33mwarning:[0m unexpected number of arguments 2 in call to ‘_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv’, should be 0[0;33mwarning:[0m unexpected number of arguments 4 in call to ‘_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv’, should be 0[0;33mwarning:[0m unexpected number of arguments 5 in call to ‘_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv’, should be 0[0;33mwarning:[0m unexpected number of arguments 4 in call to ‘_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv’, should be 0[0;33mwarning:[0m unexpected number of arguments 2 in call to ‘_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv’, should be 0[0;33mwarning:[0m unexpected number of arguments 3 in call to ‘_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv’, should be 0error: unresolved symbol: CapturePixelDataerror: unresolved symbol: GetARPointClouderror: unresolved symbol: GetAmbientIntensityerror: unresolved symbol: GetBlendShapesInfoerror: unresolved symbol: GetLastHitTestResulterror: unresolved symbol: GetTrackingQualityerror: unresolved symbol: GetVideoTextureHandleserror: unresolved symbol: HitTesterror: unresolved symbol: IsARKitFaceTrackingConfigurationSupportederror: unresolved symbol: IsARKitSessionConfigurationSupportederror: unresolved symbol: IsARKitWorldTrackingSessionConfigurationSupportederror: unresolved symbol: PauseSessionerror: unresolved symbol: SessionAddUserAnchorerror: unresolved symbol: SessionRemoveUserAnchorerror: unresolved symbol: SetCameraNearFarerror: unresolved symbol: StartFaceTrackingSessionerror: unresolved symbol: StartFaceTrackingSessionWithOptionserror: unresolved symbol: StartSessionerror: unresolved symbol: StartSessionWithOptionserror: unresolved symbol: StartWorldTrackingSessionerror: unresolved symbol: StartWorldTrackingSessionWithOptionserror: unresolved symbol: session_SetFaceAnchorCallbackserror: unresolved symbol: session_SetPlaneAnchorCallbackserror: unresolved symbol: session_SetSessionCallbackserror: unresolved symbol: session_SetUserAnchorCallbackserror: unresolved symbol: unity_CreateNativeARSessionAborting compilation due to previous errors | undefinedTraceback (most recent call last): File “/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emcc.py”, line 3063, in sys.exit(run()) File “/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emcc.py”, line 1780, in run final = shared.Building.emscripten(final, append_ext=False, extra_args=extra_args) File “/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/tools/shared.py”, line 2274, in emscripten emscripten._main(cmdline) File “/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emscripten.py”, line 2233, in _main return temp_files.run_and_clean(lambda: main( File “/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/tools/tempfiles.py”, line 93, in run_and_clean return func() File “/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emscripten.py”, line 2238, in DEBUG=DEBUG, File “/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emscripten.py”, line 2164, in main temp_files=temp_files, DEBUG=DEBUG) File “/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emscripten.py”, line 86, in emscript glue, forwarded_data = compiler_glue(metadata, libraries, compiler_engine, temp_files, DEBUG) File “/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emscripten.py”, line 218, in compiler_glue glue, forwarded_data = compile_settings(compiler_engine, libraries, temp_files) File “/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/emscripten.py”, line 541, in compile_settings cwd=path_from_root(‘src’), error_limit=300) File “/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/tools/jsrun.py”, line 132, in run_js raise Exception(‘Expected the command ’ + str(command) + ’ to finish with return code ’ + str(assert_returncode) + ‘, but it returned with code ’ + str(proc.returncode) + ’ instead! Output: ’ + str(ret)[:error_limit])Exception: Expected the command [’/Applications/Unity/Hub/Editor/2020.1.6f1/Unity.app/Contents/Tools/nodejs/bin/node’, ‘–stack_size=8192’, ‘–max-old-space-size=4096’, ‘/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/src/compiler.js’, ‘/tmp/tmp50fWJi.txt’, ‘/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/lib/Audio.js’, ‘/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/lib/Cursor.js’, ‘/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/lib/Eval.js’, ‘/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/lib/FileSystem.js’, ‘/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/lib/Logging.js’, ‘/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/lib/Profiler.js’, ‘/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/lib/SystemInfo.js’, ‘/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/lib/UnetWebSocket.js’, ‘/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/lib/Video.js’, ‘/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/lib/WebCam.js’, ‘/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/lib/WebRequest.js’, ‘/Users/someUser/Documents/Unity/Projects/unity2/UI/Unity/Assets/Best HTTP/Plugins/WebGL/BestHTTP_WebRequest.jslib’, ‘/Users/someUser/Documents/Unity/Projects/unity2/UI/Unity/Assets/Best HTTP/Examples/Helpers/Plugins/WebGL/OpenWindow.jslib’, ‘/Users/someUser/Documents/Unity/Projects/unity2/UI/Unity/Assets/Plugins/WebGL/MyPlugin.jslib’, ‘/Users/someUser/Documents/Unity/Projects/unity2/UI/Unity/Assets/Best HTTP/Plugins/WebGL/BestHTTP_WebSocket.jslib’, ‘/Users/someUser/Documents/Unity/Projects/unity2/UI/Unity/Assets/Best HTTP/Plugins/WebGL/BestHTTP_EventSource.jslib’, ‘/Applications/Unity/Hub/Editor/2020.1.6f1/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/src/library_pthread_stub.js’] to finish with return code 0, but it returned with code 1 instead! Output: // The Module object: Our interface to the outside world. We import// and export values on it. There are various ways Module can be used:// 1. Not defined. We create it here// 2. A function parameter, function(Module) { …generated code… }// 3. pre-run appended it, var Module = {}; …generated
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

Good - now Emscripten is found correctly, and the generated C++ code is compiling.

This failure occurs because the code in the project has extern methods in C#. Methods marked as extern with a the [Dllimport(“__Internal”)] attribute must be present in a native library that is linked with the Unity player when building with the IL2CPP scripting backend.
For example, this in this project one function which causes this issue is named: CapturePixelData
You have two options:

  1. Build a native library with all of the methods marked as extern with the [Dllimport(“__Internal”)] attribute for the target platform and architecture of the player. See this documentation for details about native plugins: https://docs.unity3d.com/Manual/NativePlugins.html

  2. Remove the C# code which defines this extern method. You can do that with platform dependent compilation: https://docs.unity3d.com/Manual/PlatformDependentCompilation.html