Build ITK Wasm not yet possible from official InsightSoftwareConsortium/ITK trunk?

Hi all,

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?

There is an ITK-Wasm repository with build scripts, but its environment variables in ITK-Wasm/itk_wasm_env.bash at 60223904ebb3f385c8e572defd5d8f3af97fa28a · InsightSoftwareConsortium/ITK-Wasm point to an ITK branch from May 2024 in a forked Kitware repo and the build scripts additionally contain a few patches.

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.

Thanks,

Sophonet

Hi @Sophonet ,

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.

Best,
Matt

1 Like

Hi @matt.mccormick

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).

Thanks,

Sophonet

Hi @Sophonet ,

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.

To get started, follow the create-itk-wasm instructions here.