WebAssembly / binaryen

Optimizer and compiler/toolchain library for WebAssembly
Apache License 2.0
7.52k stars 745 forks source link

2.0.17 on macOS : unexpected metadata key received from wasm-emscripten-finalize: globalImports #3829

Closed seyhajin closed 3 years ago

seyhajin commented 3 years ago

Since i have upgraded to latest version of emscripten (2.0.16 -> 2.0.17) with Homebrew, i got this error message when i compile my usual sample C program :

cache:INFO: generating system asset: generated_struct_info.json... (this will be cached in "/usr/local/Cellar/emscripten/2.0.17/libexec/cache/generated_struct_info.json" for subsequent builds)
emcc: error: unexpected metadata key received from wasm-emscripten-finalize: globalImports
FAIL: Compilation failed!: ['/usr/local/Cellar/emscripten/2.0.17/libexec/emcc', '-D_GNU_SOURCE', '-o', '/var/folders/8b/6pbtc6_517l1h3k6vzng2x0m0000gn/T/tmpd2qd3v__.js', '/var/folders/8b/6pbtc6_517l1h3k6vzng2x0m0000gn/T/tmpxkhmm2iz.c', '-O0', '-Werror', '-Wno-format', '-nostdlib', '/usr/local/Cellar/emscripten/2.0.17/libexec/cache/sysroot/lib/wasm32-emscripten/libcompiler_rt.a', '-s', 'BOOTSTRAPPING_STRUCT_INFO=1', '-s', 'STRICT', '-s', 'SINGLE_FILE', '-Wno-error=version-check', '-Wno-deprecated']

my command line :

em++ -s FETCH=1 -s TOTAL_MEMORY=268435456 -s DISABLE_EXCEPTION_CATCHING=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0  -s WASM=1 -O3 -DNDEBUG=1 -s ASYNCIFY -s FORCE_FILESYSTEM=1 -s USE_GLFW=3 --shell-file [...]/shell.html -o [...]/entity-system.html [...]/entity.c.o "[...]/raylib.a"

[...] replace full path

It worked fine on version 2.0.16. I'm on macOS Big Sur.

Anyone known about it ?

Homebrew had to install an external/independent version of binaryen

brew info emscripten

[21/04/21 12:43:09]  ~  brew info emscripten
emscripten: stable 2.0.17 (bottled), HEAD
LLVM bytecode to JavaScript compiler
https://emscripten.org/
/usr/local/Cellar/emscripten/2.0.17 (15,749 files, 1.1GB) *
  Poured from bottle on 2021-04-20 at 23:51:45
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/emscripten.rb
License: Apache-2.0 and (Apache-2.0 with LLVM-exception) and (MIT or NCSA)
==> Dependencies
Build: cmake ✔
Required: node ✔, python@3.9 ✔, yuicompressor ✔
==> Options
--HEAD
    Install HEAD version
==> Analytics
install: 2,891 (30 days), 7,419 (90 days), 23,381 (365 days)
install-on-request: 2,269 (30 days), 5,589 (90 days), 19,064 (365 days)
build-error: 0 (30 days)

brew info binaryen

[21/04/21 12:43:34]  ~  brew info binaryen  
binaryen: stable 101 (bottled), HEAD
Compiler infrastructure and toolchain library for WebAssembly
https://webassembly.org/
/usr/local/Cellar/binaryen/101 (1,453 files, 39MB) *
  Poured from bottle on 2021-04-19 at 12:28:40
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/binaryen.rb
License: Apache-2.0
==> Dependencies
Build: cmake ✔, python@3.9 ✔
==> Options
--HEAD
    Install HEAD version
==> Analytics
install: 977 (30 days), 2,768 (90 days), 15,432 (365 days)
install-on-request: 427 (30 days), 1,104 (90 days), 4,725 (365 days)
build-error: 0 (30 days)

I will try to reinstall binaryen but same issue.

Do you known what binaryen version using with emscripten 2.0.17 ?

kripken commented 3 years ago

This looks like a duplicate of https://github.com/emscripten-core/emscripten/issues/13943 ?

The technical details for how to find which binaryen version is used with each emscripten version in the emsdk are here: https://github.com/emscripten-core/emscripten/blob/main/docs/process.md#release-processes (however, if you use the emsdk then you should not need to think about any of that; emsdk install 2.0.17 will install the proper binaryen for you)

And specifically for 2.0.17, emscripten-releases-tags.txt says the release is from https://chromium.googlesource.com/emscripten-releases/+/f5c45e60392b82f603e3a8039c62db294fab02d2/DEPS which for binaryen points to 67094a4a9b013a9705bcbf49ec7e0e8ab744389c

seyhajin commented 3 years ago

Thanks for informations. I will use emsdk install instead of Homebrew.