ruby-wasm icon indicating copy to clipboard operation
ruby-wasm copied to clipboard

Catch the error when try to build wasm

Open frostmark opened this issue 6 years ago • 1 comments

Hello. When I tried to build hello.rb I caught follow error:

Compiling hello.rb...warning: unexpected argument type i32 at index 1 in call to 'lseek', should be i64
warning: unexpected return type i32 in call to 'lseek', should be i64
error: asm2wasm seeing an invalid argument type at index 1 (this will not validate) in call from $_mrb_io_sysseek to $_lseek (this is likely due to undefined behavior in C, like defining a function one way and calling it in another, which is important to fix)
[wasm-validator error in function $_mrb_io_sysseek] 1 != 2: call param types must match, on 
[i64] (call $_lseek
 [i32] (local.get $12)
 [i32] (local.get $13)
 [i32] (local.get $4)
)
(on argument 1)
Fatal: error in validating output
shared:ERROR: '/Users/markfrost/emsdk/fastcomp/bin/asm2wasm build/app.temp.asm.js --total-memory=16777216 --trap-mode=allow --mem-init=build/app.js.mem --mem-base=1024 --wasm-only -o build/app.wasm --mvp-features' failed (1)

frostmark avatar Jul 13 '19 07:07 frostmark

backlog with EMCC_DEBUG=1

emcc:DEBUG: emcc step "link" took 1.24 seconds
emcc:DEBUG: saving intermediate processing steps to /tmp/emscripten_temp
emcc:DEBUG: (not saving intermediate /tmp/emscripten_temp/emcc-0-basebc.bc because deferring linking)
shared:DEBUG: using response file for /Users/markfrost/emsdk/fastcomp/fastcomp/bin/opt
shared:DEBUG: successfully executed /Users/markfrost/emsdk/fastcomp/fastcomp/bin/opt @/tmp/emscripten_temp/tmpj7Zllz.response
emcc:DEBUG: emcc step "post-link" took 0.46 seconds
emcc:DEBUG: LLVM => JS
shared:DEBUG: TEMP_DIR not defined in /Users/markfrost/.emscripten, using /tmp
emscripten:DEBUG: emscript: llvm backend: /Users/markfrost/emsdk/fastcomp/fastcomp/bin/llc /tmp/emscripten_temp/app.bc -march=js -filetype=asm -o /tmp/emscripten_temp/tmpzD0aeg.4.js -emscripten-stack-size=5242880 -O0 -emscripten-precise-f32 -emscripten-assertions=1 -emscripten-no-aliasing-function-pointers -emscripten-global-base=1024 -emscripten-no-exit-runtime -emscripten-wasm -emscripten-only-wasm
warning: unexpected argument type i32 at index 1 in call to 'lseek', should be i64
warning: unexpected return type i32 in call to 'lseek', should be i64
shared:DEBUG: successfully executed /Users/markfrost/emsdk/fastcomp/fastcomp/bin/llc /tmp/emscripten_temp/app.bc -march=js -filetype=asm -o /tmp/emscripten_temp/tmpzD0aeg.4.js -emscripten-stack-size=5242880 -O0 -emscripten-precise-f32 -emscripten-assertions=1 -emscripten-no-aliasing-function-pointers -emscripten-global-base=1024 -emscripten-no-exit-runtime -emscripten-wasm -emscripten-only-wasm
emscripten:DEBUG:   emscript: llvm backend took 0.459275007248 seconds
emscripten:DEBUG: emscript: js compiler glue
shared:DEBUG: successfully executed /Users/markfrost/emsdk/node/8.9.1_64bit/bin/node /Users/markfrost/emsdk/fastcomp/emscripten/src/compiler.js /tmp/emscripten_temp/tmpH5eZyz.txt /Users/markfrost/emsdk/fastcomp/emscripten/src/library_pthread_stub.js
emscripten:DEBUG:   emscript: glue took 0.251468896866 seconds
emscripten:DEBUG: emscript: python processing: function tables and exports
emscripten:DEBUG: global_base: 1024 stack_base: 111696, stack_max: 5354576, dynamic_base: 5354576, static bump: 110672
emscripten:DEBUG: asm text sizes[[2685958, 7628], 8308, 84, 3503, 0, 2056, 24611, 972, 2, 2642, 19925]
emscripten:DEBUG:   emscript: python processing: function tables and exports took 0.0245089530945 seconds
emscripten:DEBUG: global_base: 1024 stack_base: 111696, stack_max: 5354576, dynamic_base: 5354576, static bump: 110672
emscripten:DEBUG: global_base: 1024 stack_base: 111696, stack_max: 5354576, dynamic_base: 5354576, static bump: 110672
emscripten:DEBUG: emscript: python processing: finalize
emscripten:DEBUG:   emscript: python processing: finalize took 0.00663900375366 seconds
emcc:DEBUG: emcc step "emscript (llvm => executable code)" took 0.85 seconds
emcc:DEBUG: emcc step "source transforms" took 0.00 seconds
emcc:DEBUG: wrote memory initialization to build/app.js.mem
emcc:DEBUG: emcc step "memory initializer" took 0.08 seconds
emcc:DEBUG: emcc step "js opts" took 0.00 seconds
emcc:DEBUG: separating asm
shared:DEBUG: successfully executed /usr/local/opt/python@2/bin/python2.7 /Users/markfrost/emsdk/fastcomp/emscripten/tools/separate_asm.py /tmp/emscripten_temp/app.bc.o.js.mem.js build/app.temp.asm.js /tmp/emscripten_temp/app.bc.o.js.mem.js Module["asm"]
emcc:DEBUG: using binaryen
emcc:DEBUG: asm2wasm (asm.js => WebAssembly): /Users/markfrost/emsdk/fastcomp/bin/asm2wasm build/app.temp.asm.js --total-memory=16777216 --trap-mode=allow --mem-init=build/app.js.mem --mem-base=1024 --wasm-only -o build/app.wasm --mvp-features
error: asm2wasm seeing an invalid argument type at index 1 (this will not validate) in call from $_mrb_io_sysseek to $_lseek (this is likely due to undefined behavior in C, like defining a function one way and calling it in another, which is important to fix)
[wasm-validator error in function $_mrb_io_sysseek] 1 != 2: call param types must match, on 
[i64] (call $_lseek
 [i32] (local.get $12)
 [i32] (local.get $13)
 [i32] (local.get $4)
)
(on argument 1)
Fatal: error in validating output
shared:ERROR: '/Users/markfrost/emsdk/fastcomp/bin/asm2wasm build/app.temp.asm.js --total-memory=16777216 --trap-mode=allow --mem-init=build/app.js.mem --mem-base=1024 --wasm-only -o build/app.wasm --mvp-features' failed (1)
cache:DEBUG: PID 30783 released multiprocess file lock to Emscripten cache at /Users/markfrost/.emscripten_cache/asmjs

frostmark avatar Jul 13 '19 07:07 frostmark