Hello!
I’m experimenting with converting an existing project here to WebAssembly.
This project has several modules, each with its own library and test
executable. My current approach, just to see if I can get things running,
is to build those test executables using the default emscripten shell.html
file. That process has been successful so far, except when I try to add a
binding via embind. Trying to “link” in the generated .js file with
--post-js results in a runtime error apparently before any of the project
code is run: “Module.arguments has been replaced with plain arguments_ (the
initial value can be provided on Module, but after startup the value is
only looked for on a local variable of that name)”
I have this relevant section of my CMakeLists file:
add_custom_command(OUTPUT Utils-bindings.js
COMMAND
${CMAKE_CXX_COMPILER}
--bind
“${CMAKE_CURRENT_SOURCE_DIR}/base/emscripten.cc”
-o
Utils-bindings.js
DEPENDS
“${CMAKE_CURRENT_SOURCE_DIR}/base/emscripten.cc”
)
target_link_options(${Utils_TEST} PUBLIC --bind --post-js
Utils-bindings.js)
Which generates these commands:
em++ --bind base/emscripten.cc -o Utils-bindings.js
em++ -s DISABLE_EXCEPTION_CATCHING=2 -s WASM=1 -s SAFE_HEAP=1 -s
WARN_UNALIGNED=1 -fsanitize=undefined -Oz -s ASSERTIONS=1 -s
DEMANGLE_SUPPORT=1 -g -Wall -fno-omit-frame-pointer -m32 --bind --post-js
Utils-bindings.js @CMakeFiles/Utils-test_g.dir/objects1.rsp -o
Utils-test_g.html @CMakeFiles/Utils-test_g.dir/linklibs.rsp
Loading Utils-test_g.html in a browser produces the error. I’ve tried all
of the --(extern-)?(pre|post)-js permutations without success. I’m well
out of my depth and have been trying whatever I can find at this point.
How do I get these library bindings “linked” into the “executable”?
Thanks!
~Michael Iatauro
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/emscripten-discuss/27a6a725-37f0-4e29-a2ee-b5d47deaeee4n%40googlegroups.com.