I do have Emscripten. I just have a problem with gen_struct_info due to which I can't generate JavaScript glue code and a WebAssembly module when not using the "-s SIDE_MODULE=1" setting and can't generate a decent, non-corrupt (I assume) WebAssembly module when using the "-s SIDE_MODULE" setting. Didn't you look at the GitHub issue I linked to?
This are the contents of the first post there:
This time I've built LLVM 9.0.0 with the -A x64 and -Thost=x64 flags and also built Binaryen and Emscripten's asm.js optimizer again, then tried to compile some C code to WebAssembly. But I get the same error as before:
Traceback (most recent call last):
File "C:\emscripten\emcc.py", line 3316, in <module>
sys.exit(run(sys.argv))
File "C:\emscripten\emcc.py", line 1947, in run
final = shared.Building.emscripten(final, target + '.mem', js_libraries)
File "C:\emscripten\tools\shared.py", line 2197, in emscripten
emscripten.run(infile, outfile, memfile, js_libraries)
File "C:\emscripten\emscripten.py", line 2560, in run
shared.Settings.STRUCT_INFO = shared.Cache.get(generated_struct_info_name, ensure_struct_info)
File "C:\emscripten\tools\cache.py", line 133, in get
temp = creator()
File "C:\emscripten\emscripten.py", line 2557, in ensure_struct_info
gen_struct_info.main(['-qo', out, path_from_root('src', 'struct_info.json')])
File "C:\emscripten\tools\gen_struct_info.py", line 529, in main
struct_info = inspect_code(header_files, cpp_opts, structs, defines)
File "C:\emscripten\tools\gen_struct_info.py", line 407, in inspect_code
info = shared.run_js(js_file[1]).splitlines()
File "C:\emscripten\tools\shared.py", line 1090, in run_js
return jsrun.run_js(filename, engine, *args, **kw)
File "C:\emscripten\tools\jsrun.py", line 155, 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 ['C:\\Program Files\\nodejs\\node.exe', 'c:\\users\\osman\\appdata\\local\\temp\\tmpadbhvx.js'] to finish with return code 0, but it returned with code -1073741819 instead! Output:
(The Node output from above is empty, by the way).
The command I ran was:
emcc -std=c11 -Wall -pedantic main.c -Os -s WASM=1 -s SIDE_MODULE=1 -s BINARYEN_ASYNC_COMPILATION=0 -o main.wasm
And it gave me a .wasm file -- but the file is corrupted. When I tried to click "Show WebAssembly" in the context menu that comes up when right-clicking on a .wasm file in Visual Studio Code's left pane, I had these two errors:
Unable to open 'main.wasm': resource is not available.
and
readWasm failed: 000007b: error: invalid linking metadata version: 2
Any help or advice is greatly appreciated. Thanks in advance.
____________________________________________________________________
Anyway, yeah, I do have Emscripten; I just want to use the Wasm Backend with it instead of Fastcomp.