Error:Failed to build the official example WrappedAsyncClipper with VTK 9.6.

Hello, recently I tried to build WebAssembly with VTK 9.6, and successfully built VTK after enabling VTK_WEBASSEMBLY_THREADS=TRUE. However, when I attempted to build WrappedAsyncClipper without a main function, an error was thrown. The command I used to build VTK 9.6 is as follows:

emcmake cmake -S D:\vtk\vtk9.6 -B D:\vtk\vtk9.6wb -G "Ninja"  -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DVTK_ENABLE_WEBGPU:BOOL=OFF -DVTK_WEBASSEMBLY_THREADS:BOOL=TRUE -DVTK_BUILD_EXAMPLES:BOOL=TRUE 

Command used to build the example:

emcmake cmake -S D:\vtk\vtk9.6\Examples\Emscripten\Cxx\WrappedAsyncClipper\ -B D:\vtk\vtkExample\WraapedAsyncClipper\ -G "Ninja" -DVTK_DIR=D:\vtk\vtk9.6wb\  -DCMAKE_BUILD_TYPE=Release

And an exception will be thrown during the final linking phase:

It prompts that the main function must be defined, but in many cases we do not need the main function. This example, in particular, demonstrates how to start WebAssembly without using the main function.

Hello,

Without a verbose log it’s hard to tell. With just that screen capture I can only tell that the linker is expecting the implementation of the main()function somewhere. That is standard C/C++. Now, to build a library without an entry point, you somehow need to explicitly tell the linker to not look for a main() (e.g. via the --no-entry linker flag).

best,

PC

Hello, thank you for your reply.
All the log output is normal. I am compiling the WrappedAsyncClipper example from the official examples, following the steps in the documentation exactly. It can be built and run successfully with VTK 9.5, but this error is thrown during the final linking phase with VTK 9.6.

Likely the example code needs to be patched/updated in order to link against the newer version of VTK.

Hello @ZLong-Li,

Thank you for sharing the command line and verbose log. You are correct, we do NOT need to define a main() in that example. I will look into this and get back.

welp, i broke this in https://gitlab.kitware.com/vtk/vtk/-/commit/ea72ffe886a64f9bb17949f58b1d3a170433f78a

The -sPROXY_TO_PTHREAD=1 with INTERFACE visibility causes emscripten to compile in the proxy main file (crt1_proxy_main.c) which references a main().

I will fix it upstream and likely release in 9.6.1