Skip to content

Difference between Binaryen.js release and debug builds regarding BigInt #5647

@dcodeIO

Description

@dcodeIO

Debug builds of Binaryen.js (both JS and Wasm) seem to differ from Release builds, in that Debug builds appear to anticipate BigInt integration in the C ABI while Release builds do not.

Compiling the binaryen_js target using -DCMAKE_BUILD_TYPE=Debug fails at the end of compilation during wasm2js invocation:

[100%] Linking CXX executable bin/binaryen_js.js
em++: error: wasm2js does not support WASM_BIGINT
make[3]: *** [CMakeFiles/binaryen_js.dir/build.make:393: bin/binaryen_js.js] Error 1
make[2]: *** [CMakeFiles/Makefile2:363: CMakeFiles/binaryen_js.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:370: CMakeFiles/binaryen_js.dir/rule] Error 2
make: *** [Makefile:190: binaryen_js] Error 2
emmake: error: 'make -j12 binaryen_js' failed (returned 2)

Compiling the binaryen_wasm target using -DCMAKE_BUILD_TYPE=Debug works, but yields a binary where _BinaryenLiteralInt64 expects a BigInt argument, not two number arguments (low and high bits), then failing at runtime when _BinaryenLiteralInt64 is invoked with two number values:

TypeError: Cannot convert [some number] to a BigInt
  at file://path/to/binaryen_wasm.js:745:22

Compiling either using -DCMAKE_BUILD_TYPE=Release produces artifacts that do not assume BigInt integration.

Origin seems to be in CmakeLists.txt, where -sWASM_BIGINT is specified for Debug builds only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions