Closed
Description
I'm getting the following error while trying to run a build:
Traceback (most recent call last):
File "/usr/local/Cellar/emscripten/1.38.44/libexec/emcc.py", line 3560, in <module>
sys.exit(run(sys.argv))
File "/usr/local/Cellar/emscripten/1.38.44/libexec/emcc.py", line 2131, in run
final = shared.Building.emscripten(final, target + '.mem', js_libraries)
File "/usr/local/Cellar/emscripten/1.38.44/libexec/tools/shared.py", line 2158, in emscripten
emscripten.run(infile, outfile, memfile, js_libraries)
File "/usr/local/Cellar/emscripten/1.38.44/libexec/emscripten.py", line 2606, in run
return temp_files.run_and_clean(lambda: emscripter(
File "/usr/local/Cellar/emscripten/1.38.44/libexec/tools/tempfiles.py", line 105, in run_and_clean
return func()
File "/usr/local/Cellar/emscripten/1.38.44/libexec/emscripten.py", line 2607, in <lambda>
infile, outfile_obj, memfile, libraries, shared.COMPILER_ENGINE, temp_files, shared.DEBUG)
File "/usr/local/Cellar/emscripten/1.38.44/libexec/emscripten.py", line 2215, in emscript_wasm_backend
asm_consts, asm_const_funcs = create_asm_consts_wasm(forwarded_json, metadata)
File "/usr/local/Cellar/emscripten/1.38.44/libexec/emscripten.py", line 2347, in create_asm_consts_wasm
asm_consts[int(k)] = const
IndexError: list assignment index out of range
Here is my version info:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.38.44
clang version 9.0.0 (tags/RELEASE_900/final)
Target: x86_64-apple-darwin19.2.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
shared:WARNING: LLVM version appears incorrect (seeing "9.0", expected "10.0")
shared:INFO: (Emscripten: Running sanity checks)
Also, I have no idea why it expects to see LLVM "10.0".
Activity
tlively commentedon Jan 6, 2020
Did you install emscripten using emsdk? It looks like maybe you didn't due to the "LLVM version appears incorrect" warning. Since the LLVM wasm backend and Emscripten are co-developed, it is not expected that Emscripten will work with arbitrary LLVM versions. I strongly recommend installing via emsdk, but if you must assemble your own emscripten installation, then check for known-compatible versions of the various tools at https://chromium.googlesource.com/emscripten-releases/.
All upstream LLVM commits after the LLVM 9.0 branch point have version 10.0. Emscripten uses a tip-of-tree build of LLVM, so it expects one of these 10.0 builds.
akolybelnikov commentedon Jan 9, 2020
I haven't installed emsdk manually, it's being installed by
cargo web
. The warning about the LLVM version is ok, as long as it remains a warning, but the error above interferes with the build.sbc100 commentedon Jan 9, 2020
From the error message it looks like you are using the homebrew version of emscripten, so it could be a configuration issue.
Can you trying installing via the emsdk and see if you get the same results? If that works then I would recommend filing a bug with the homebrew package.
sbc100 commentedon Jan 9, 2020
Ok I took a deeper look. I does indeed look like a mismatch between the version of binaryen and version of emscripten that are being used together.
The following change to binaryen changed the output in a way that would make the above exception occur:
WebAssembly/binaryen#2408
This change to binaryen landed 2 months ago after the 1.39.1 release of emscripten. By comparison your version of emscripten is 4 months old. So it looks like the homebrew package is somehow misconfigured.
sbc100 commentedon Jan 9, 2020
Can you run the failing command with EMCC_DEBUG=1 so I can confirm my suspicion?
tlively commentedon Jan 9, 2020
@akolybelnikov I filed a bug on cargo-web about updating their Emscripten support. For now I would use emsdk to install Emscripten manually as a workaround https://emscripten.org/docs/getting_started/downloads.html.
akolybelnikov commentedon Jan 9, 2020
@sbc100 , here is the error with EMCC_DEBUG=1:
https://gist.github.com/akolybelnikov/6ba29273b16cc885d702de75fcebd6f8
sbc100 commentedon Jan 9, 2020
Yes, it looks like you
/usr/local/opt/binaryen
is too recent. Do you know where that comes from?akolybelnikov commentedon Jan 9, 2020
Honestly, no idea. I followed the docs here: https://github.com/koute/cargo-web and
cargo
installed Emscripten in the background, and that's what I have in.emscripten
:sbc100 commentedon Jan 16, 2020
I would file a bug with cargo-web then. It clear the binaryen version is wrong here. If its ok with you we can close this bug?
akolybelnikov commentedon Jan 17, 2020
Thank you all for the support!