# How to build vtk-wasm64

**URL:** https://discourse.vtk.org/t/how-to-build-vtk-wasm64/13574
**Category:** Web
**Created:** [March 18, 2024, 8:20pm UTC](https://discourse.vtk.org/t/how-to-build-vtk-wasm64/13574 "2024-03-18T20:20:06Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![pqng](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/edb3f5/32.png) [@pqng](https://discourse.vtk.org/u/pqng)
#### Post date: [March 18, 2024, 8:20pm UTC](https://discourse.vtk.org/t/how-to-build-vtk-wasm64/13574/1 "2024-03-18T20:20:06Z")

</div>

Hi,

I am experimenting with \>4GB limitation using vtk-wasm. However, I am getting error wasm32 object file can’t be linked in wasm64 mode. How do I compile vtk-wasm in wasm64 to test this?

Thanks,

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [March 18, 2024, 8:26pm UTC](https://discourse.vtk.org/t/how-to-build-vtk-wasm64/13574/2 "2024-03-18T20:26:29Z")

</div>

Pass these extra args to cmake when configuring VTK.  
`-DCMAKE_C_FLAGS=MEMORY64 -DCMAKE_CXX_FLAGS=MEMORY64`

That is sufficient to give you wasm64. Although, don’t be too excited. You will run into some issues with the SDL2 render window [¹](https://github.com/emscripten-core/emscripten/issues/20273). It was fixed in SDL3 but emscripten still uses SDL2.

---

<div class="post-metadata">

### Author: ![pqng](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/p/edb3f5/32.png) [@pqng](https://discourse.vtk.org/u/pqng)
#### Post date: [March 18, 2024, 10:16pm UTC](https://discourse.vtk.org/t/how-to-build-vtk-wasm64/13574/3 "2024-03-18T22:16:50Z")

</div>

Thanks! I was just curious about the build process. Passing the flags make it compiled, but the correct value is -sMEMORY64.

However, after compiling VTK WASM, I tried to build my app against the newly installed library, and got,

```auto
Could not find a configuration file for package "VTK" that is compatible
  with requested version "".

  The following configuration files were considered but not accepted:

    /scratch/tools/VTK/install-wasm-64/lib/cmake/vtk-9.3/vtk-config.cmake, version: 9.3.20240311 (64bit)

```

The same app and build script works with wasm 32-bit. I know wasm64 bit is still WIP. So, if you have any ideas how to proceed, it would be great. Otherwise, I just put off my experiment to wait for official release.

Thanks,

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [March 19, 2024, 12:00am UTC](https://discourse.vtk.org/t/how-to-build-vtk-wasm64/13574/4 "2024-03-19T00:00:53Z")

</div>

That happens because your project is trying to find 32-bit VTK wasm.

Pass those flags even when configuring your project.

---

<div class="post-metadata">

### Author: ![Charles\_CFD](https://discourse.vtk.org/user_avatar/discourse.vtk.org/charles_cfd/32/9836_2.png) [@Charles\_CFD](https://discourse.vtk.org/u/Charles_CFD)
#### Post date: [October 29, 2025, 3:05pm UTC](https://discourse.vtk.org/t/how-to-build-vtk-wasm64/13574/5 "2025-10-29T15:05:44Z")

</div>

> [@jaswantp](#):
>
> -DCMAKE\_C\_FLAGS=MEMORY64 -DCMAKE\_CXX\_FLAGS=MEMORY64

Are those flags still needed with the current VTK master ? Or would `-DVTK_WEBASSEMBLY_64_BIT=ON` replace them ?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [October 29, 2025, 4:00pm UTC](https://discourse.vtk.org/t/how-to-build-vtk-wasm64/13574/6 "2025-10-29T16:00:37Z")

</div>

Those flags are not needed when building VTK.

They will be needed when you are building another CMake project which links to a VTK installation.
