maybe a question for @matt.mccormick: Is there a reason that compiling ITK for wasm using emscripten is not possible from the main ITK repository InsightSoftwareConsortium/ITK?
I think it would greatly simplify building custom Wasm applications that use ITK as static libraries built with emscripten if it would be possible from the main trunk.
I have merged many of the patches for ITK-Wasm into upstream ITK.
Most of the remaining patches were temporary and are related to a lack of threading and related parallelism support in WASI. However, I have been resolving this recently,
They will be removed after support has been finalized.
This is great news, thanks! So which recent revision from which branch in which repository (upstream vs. kitware) should currently be used for wasm builds?
Also is there a current list of cmake flags that need to be applied? In my recent activities often ITK itself could be built successfully but the final wasm application utilizing ITK as a library could not be linked due to some emscripten error (“attempting to pop from empty stack” or something similar - which is difficult to debug).
It is recommended to use the quay.io/itkwasm/emscripten and quay.io/itkwasm/wasi docker images. These contain pre-built ITK and a CMake toolchain file that specifies all the flags. And other tooling that improves performance and debugging capabilities. Builds can be driven through the itk-wasm npm package.
one more question on this topic. I have built my own ITK WASM based on the flags and revisions in the ITK-Wasm Dockerfile and related environment variables. However, after successfully compiling this for a threading environment (with an additional -pthread compile/link flag), the workers in my app crash on initialization (console shows __emscripten_thread_crashed is not defined. If I remove the ITK dependency, the web app starts (with limited functionality). Likewise, if I remove the thread compile/link flag for everything, the web app starts as well.
Where can I find compile flags or revisions for a thread build of ITK for WASM that does not cause this crash? Or is it something else that my app needs to do in order to fix the problem?
You have mentioned earlier that the quay.io images should be used, but I am a bit lost with respect to tags - is there an image supporting threads?
thanks - this was quick . In the meantime I have noticed that my application starts when it has been compiled with -O2 instead of -O3. Likewise it starts when -sASSERTIONS has been set, so this seems to be an emscripten problem?
However it does not use multi-threaded processing functionality so far, so the mismatch between a WorkerPool and pthread has not come up (my application uses pthreads).