Build fails with "Exception: il2cpp.exe did not run properly"

Hello,

We are attempting to port an existing android/ios game to webgl and the build process always fails with “Exception: il2cpp.exe did not run properly”. We have seen a total of 6 different underlying errors that seem related to each other (2 samples attached).

The port was attempted on 5.5.0f3 however we tried downgrading to 5.4.0f3 without success. Builds fail for both development with/without pre-build player and release builds with/without engine stripping.

Short log (sample 1)

Building build.js with EmscriptenToolChain.
Output directory: Repo\client\Temp\StagingArea\Data\Native
Cache directory: Repo\client\Library\il2cpp_cache
il2cpp.exe didn’t catch exception: Unity.IL2CPP.Building.BuilderFailedException: WARNING:root:did not see a source tree above or next to the LLVM root directory (guessing based on directory of C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_FastComp_Win\llc), could not verify version numbers match
INFO:root:(Emscripten: Running sanity checks)
WARNING:root:java does not seem to exist, required for closure compiler, which is optional (define JAVA in C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\emscripten.config if you want it)
WARNING:root:closure compiler will not be available
Could not write crash dump file: unknown error
0x00007FF6A2CD8536 (0x00007FF6A337FFCB 0x00000236E053E190 0x00000236E04F7770 0x00000236E0541290)
0x000000ECD2D89740 (0x00000236E053E190 0x00000236E04F7770 0x00000236E0541290 0x00007FF6A32028CF)
0x00007FF6A337FFCB (0x00000236E04F7770 0x00000236E0541290 0x00007FF6A32028CF 0x000000000000001E)
0x00000236E053E190 (0x00000236E0541290 0x00007FF6A32028CF 0x000000000000001E 0x00000236E307E070)
0x00000236E04F7770 (0x00007FF6A32028CF 0x000000000000001E 0x00000236E307E070 0x0000000000000000)
0x00000236E0541290 (0x000000000000001E 0x00000236E307E070 0x0000000000000000 0x00000236005E6301)
0x00007FF6A32028CF (0x00000236E307E070 0x0000000000000000 0x00000236005E6301 0x0000000000000000)
0x000000000000001E (0x0000000000000000 0x00000236005E6301 0x0000000000000000 0x00007FF6A3202884)
0x00000236E307E070 (0x00000236005E6301 0x0000000000000000 0x00007FF6A3202884 0x0000000000000060)
clang++.exe: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 3.9.0 (GitHub - Unity-Technologies/emscripten-fastcomp-clang: emscripten clang 25b3441651a37f372427d536f20bdca8ff50f3cf) (GitHub - Unity-Technologies/emscripten-fastcomp: emscripten llvm c0d6d802046b209623cf86df6453126636dc74cb) (emscripten 1.36.7 : 1.36.7)
Target: asmjs-unknown-emscripten
Thread model: posix
InstalledDir: C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_FastComp_Win
clang++.exe: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang++.exe: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++.exe: note: diagnostic msg: root\AppData\Local\Temp\Il2CppTypeDefinitions-099c4e.cpp
clang++.exe: note: diagnostic msg: root\AppData\Local\Temp\Il2CppTypeDefinitions-099c4e.sh
clang++.exe: note: diagnostic msg:


ERROR:root:compiler frontend failed to generate LLVM bitcode, halting

Invocation was: Executable: “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe”
Arguments: “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\em++” -Wno-unused-value -Wno-invalid-offsetof -nostdinc -fno-strict-overflow -std=c++11 -Oz -DIL2CPP_EXCEPTION_DISABLED=1 -I"C:\Program Files\Unity\Editor\Data\il2cpp\libil2cpp" -I"C:\Program Files\Unity\Editor\Data\il2cpp\external\boehmgc\include" -I"Repo\client\Temp\StagingArea\Data\il2cppOutput" “Repo\client\Temp\StagingArea\Data\il2cppOutput\Il2CppTypeDefinitions.cpp” -o “Repo\client\Library\il2cpp_cache\EE86FBC2AFAF063EC3EFD83212F43A48.o”

at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable`1 sourceFilesToCompile)
at Unity.IL2CPP.Building.CppProgramBuilder.Build()
at il2cpp.Program.DoRun(String[ ] args)
at il2cpp.Program.Run(String[ ] args)
at il2cpp.Program.Main(String[ ] args)

Short log (sample 2)

il2cpp.exe didn’t catch exception: Unity.IL2CPP.Building.BuilderFailedException: “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc” -o “RepoPath\client\Library\il2cpp_cache\linkresult_E6B3BFB87DC5A4CE2DEBF7DACBB5FA9B\build.js” -s PRECISE_F32=2 -s DISABLE_EXCEPTION_CATCHING=0 --memory-init-file 0 -O3 -s NO_EXIT_RUNTIME=1 -g2 -s ASSERTIONS=1 -s DEMANGLE_SUPPORT=1 -s USE_WEBGL2=1 -s TOTAL_MEMORY=268435456 --emit-symbol-map --output_eol linux -s SIDE_MODULE=1 -s ASM_JS=2 -s MEMFS_APPEND_TO_TYPED_ARRAYS=1 @“root\AppData\Local\Temp_1418355373\response.rsp”

WARNING:root:did not see a source tree above or next to the LLVM root directory (guessing based on directory of C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_FastComp_Win\llc), could not verify version numbers match
INFO:root/Emscripten: Running sanity checks)
WARNING:root:java does not seem to exist, required for closure compiler, which is optional (define JAVA in C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\emscripten.config if you want it)
WARNING:root:closure compiler will not be available
warning: unexpected number of arguments 4 in call to ‘_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv’, should be 0
warning: unexpected number of arguments 4 in call to ‘_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv’, should be 0
warning: unexpected number of arguments 2 in call to ‘_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv’, should be 0
warning: unexpected number of arguments 3 in call to ‘_ZN6il2cpp6icalls8mscorlib6System6String22RedirectToCreateStringEv’, should be 0
emcc: warning: cannot represent a NaN literal ‘0x1f0c1b22f60’ with custom bit pattern in NaN-canonicalizing JS engines (e.g. Firefox and Safari) without erasing bits!
emcc: warning: cannot represent a NaN literal ‘0x1f0c1b22f60’ with custom bit pattern in NaN-canonicalizing JS engines (e.g. Firefox and Safari) without erasing bits!
Traceback (most recent call last):
File “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc”, line 13, in
emcc.run()
File “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc.py”, line 1811, in run
JSOptimizer.flush()
File “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc.py”, line 1708, in flush
run_passes(chunks[0], title, just_split=False, just_concat=False)
File “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc.py”, line 1681, in run_passes
final = shared.Building.js_optimizer(final, passes, debug_level >= 4, JSOptimizer.extra_info, just_split=just_split, just_concat=just_concat)
File “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\tools\shared.py”, line 1756, in js_optimizer
ret = js_optimizer.run(filename, passes, NODE_JS, debug, extra_info, just_split, just_concat)
File “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\tools\js_optimizer.py”, line 555, in run
return temp_files.run_and_clean(lambda: run_on_js(filename, passes, js_engine, source_map, extra_info, just_split, just_concat))
File “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\tools\tempfiles.py”, line 78, in run_and_clean
return func()
File “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\tools\js_optimizer.py”, line 555, in
return temp_files.run_and_clean(lambda: run_on_js(filename, passes, js_engine, source_map, extra_info, just_split, just_concat))
File “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\tools\js_optimizer.py”, line 450, in run_on_js
filenames = pool.map(run_on_chunk, commands, chunksize=1)
File “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\lib\multiprocessing\pool.py”, line 250, in map
return self.map_async(func, iterable, chunksize).get()
File “C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\lib\multiprocessing\pool.py”, line 554, in get
raise self._value
AssertionError: Error in optimizer (return code -1073740791):

at Unity.IL2CPP.Building.CppProgramBuilder.PostprocessObjectFiles(IEnumerable`1 objectFiles, CppToolChainContext toolChainContext)
at Unity.IL2CPP.Building.CppProgramBuilder.Build()
at il2cpp.Program.DoRun(String[ ] args)
at il2cpp.Program.Run(String[ ] args)
at il2cpp.Program.Main(String[ ] args)

We’re out of ideas to try out internally so any help would be greately appreciated.

2895016–212925–FullBuildLog.txt (1020 KB)

1 Like

similar problems with 5.6.0b3

1 Like

Are you still experiencing this problem? If so, try to delete Library/il2cpp_cache then build again.

If the problem persists, please submit a bug report with your project.

thanks!

1 Like

Thank you very much for your reply.

Yes the problem persists. I didn’t mention in the initial post but were deleting the Library folder for each build attempt (due to this bug Unity Issue Tracker - FileNotFoundException on 2nd build). We also tried deleting just the il2cpp_cache folder with the same results.

The problem with submitting a bug report is the size of our 8gb project and the fact that we’re an outsourcing company with explicit contractual obligations to not share the source code.

Initially we suspected that some library/piece of code/plugin could be causing the issue so we started in parallel both stripping the projects of non-essentials and adding essentials to an empty project. The empty project + essentials is building fine while the stripped original project is still failing. This process is still ongoing until the ‘empty project’ will fail to build or the ‘stripped project’ will build. It is however, painfully slow.

We also tried updating emscripten to the latest version in hopes that we’ll make some progress with no result.

I want to thank you again for the reply and I’d like to mention that since we have resources dedicated to figuring this problem out in our particular case any information could be incredibly helpful.