You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case a WASM binary is linked dynamically the option to emit typescript interface does not work.
The main cause seems to be that the generated wasm and js file are copied to a temp directory during running emitting the typescript interfaces while all of the possible dependencies are not.
The example workaround above simply copies all .so files existent in the same location as the wasm/js file to the same location in the temp directory. With the workaround the dynamic lib is properly loaded and the typescript interfaces are emitted. There is most likely a much more sophisticated solution to that problem.
Version of emscripten/emsdk:
3.1.56
Failing command line in full:
The issue occurs during linking when option --emit-tsd or --embind-emit-tsd is performed
Full link command and output with -v appended:
As soon as the generated WASM binary contains the following dynamic link section: dylink.0 .so NAMEOFLIB.so the linking step fails within: function run_embind_gen (https://github.com/emscripten-core/emscripten/blob/63c648fa17be49fa9640d4a40c8ba2f7a9b2d444/tools/link.py#L1924C5-L1924C19) due to node execution failure while trying to load any dynamically linked dependencies in: out = shared.run_js_tool(outfile_js, [], node_args, stdout=PIPE)
Possible solution
During linkage all dependencies are already propagated to emscripten for the actual linking step, ensure these dependencies are not only put into the dynlink.0 section but also properly copied/symlinked from their origin to the temporary folder used for generating tsd utilizing node when using --embind-emit-tsd / --emit-tsd.
The text was updated successfully, but these errors were encountered:
In case a WASM binary is linked dynamically the option to emit typescript interface does not work.
The main cause seems to be that the generated wasm and js file are copied to a temp directory during running emitting the typescript interfaces while all of the possible dependencies are not.
As a workaround I changed link.py #
emscripten/tools/link.py
Line 1963 in 63c648f
The example workaround above simply copies all .so files existent in the same location as the wasm/js file to the same location in the temp directory. With the workaround the dynamic lib is properly loaded and the typescript interfaces are emitted. There is most likely a much more sophisticated solution to that problem.
Version of emscripten/emsdk:
3.1.56
Failing command line in full:
The issue occurs during linking when option --emit-tsd or --embind-emit-tsd is performed
Full link command and output with
-v
appended:As soon as the generated WASM binary contains the following dynamic link section:
dylink.0 .so NAMEOFLIB.so
the linking step fails within: function run_embind_gen (https://github.com/emscripten-core/emscripten/blob/63c648fa17be49fa9640d4a40c8ba2f7a9b2d444/tools/link.py#L1924C5-L1924C19) due to node execution failure while trying to load any dynamically linked dependencies in:out = shared.run_js_tool(outfile_js, [], node_args, stdout=PIPE)
Possible solution
During linkage all dependencies are already propagated to emscripten for the actual linking step, ensure these dependencies are not only put into the dynlink.0 section but also properly copied/symlinked from their origin to the temporary folder used for generating tsd utilizing node when using --embind-emit-tsd / --emit-tsd.
The text was updated successfully, but these errors were encountered: