Building an application with VTK WebAssembly

Hello, I am building the 3D Slicer tool for web assembler using the following commands:

sudo docker run --rm --entrypoint /bin/bash -v $PWD:/work -p 8000:8000 -it dockcross/web-wasm:20230222-162287d
emcmake cmake . -G Ninja
ninja

However, I am encountering an error as shown in the image below. I have built VTK with the corrections mentioned in https://gitlab.kitware.com/vtk/vtk/-/commit/505304bd33dd8602f77f075fba5b4017e360a981 based on the recommendations in VTK WASM - #6 by mazurkin.daniel. VTK itself was built using the instructions in Building using emscripten for WebAssembly - VTK documentation in the build-vtk-wasm folder. You can download the project archive and view the CMakeLists.txt file at forum_example - Google Drive.

Also, I would like to mention that Module[‘_main’] is empty, and it is not clear how to specify what should be in main. It should be in Cone.cxx.

@jaswantp

Error was solved We assembled a widget from 3D Slicer in the browser

Looks like you redefined the Module in the onRuntimeInitialized handler? Not sure. Please do not hesitate to share what fixed it for you.

It was about incorrect flags, the following flags in emscripten helped me.
image