Skip to content

Instantly share code, notes, and snippets.

@originalsouth
Created October 11, 2019 13:14
Show Gist options
  • Save originalsouth/247664538493e7181546d1e210374f5f to your computer and use it in GitHub Desktop.
Save originalsouth/247664538493e7181546d1e210374f5f to your computer and use it in GitHub Desktop.
Emscripten bug
int life_the_universe_and_everything()
{
return 42;
}
OPTLEVEL=3
bug.js: bug.c
emcc -Wall -Wextra -flto -O$(OPTLEVEL) -s ENVIRONMENT=worker -o $@ $<
clean:
-rm -rf bug.js bug.wasm
@originalsouth
Copy link
Author

Running the makefile yields a Unknown option '--mvp-features' error:

% make
emcc -Wall -Wextra -flto -O3 -s ENVIRONMENT=worker -o bug.js bug.c
Unknown option '--mvp-features'
Traceback (most recent call last):
  File "/usr/lib/emscripten/emcc.py", line 3661, in <module>
    sys.exit(run(sys.argv))
  File "/usr/lib/emscripten/emcc.py", line 2498, in run
    optimizer)
  File "/usr/lib/emscripten/emcc.py", line 3054, in do_binaryen
    emitting_js=not target.endswith(WASM_ENDINGS))
  File "/usr/lib/emscripten/tools/shared.py", line 2476, in minify_wasm_js
    js_file = Building.metadce(js_file, wasm_file, minify_whitespace=minify_whitespace, debug_info=debug_info)
  File "/usr/lib/emscripten/tools/shared.py", line 2562, in metadce
    out = run_process(cmd, stdout=PIPE).stdout
  File "/usr/lib/emscripten/tools/shared.py", line 170, in run_process
    ret = subprocess.run(cmd, check=check, input=input, *args, **kw)
  File "/usr/lib/python3.7/subprocess.py", line 487, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/usr/bin/wasm-metadce', '--graph-file=/tmp/tmppvdoex2a.txt', 'bug.wasm', '-o', 'bug.wasm', '--mvp-features']' returned non-zero exit status 1.
make: *** [Makefile:4: bug.js] Error 1

while running the makefile with OPTLEVEL=2 compiles regularly

% make OPTLEVEL=2
emcc -Wall -Wextra -flto -O2 -s ENVIRONMENT=worker -o bug.js bug.c

on

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.38.47
clang version 10.0.0 (/srcdest/llvm-project 411f1885b655ea622fe124a87a6eadfd988d7a5e)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/emscripten-llvm
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/9.2.0
Selected GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/9.2.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
shared:INFO: (Emscripten: Running sanity checks)

as provided by Archlinux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment