# build VTK-9.1.0 to webassembly

**URL:** https://discourse.vtk.org/t/build-vtk-9-1-0-to-webassembly/7895
**Category:** Support
**Created:** [February 23, 2022, 1:38am UTC](https://discourse.vtk.org/t/build-vtk-9-1-0-to-webassembly/7895 "2022-02-23T01:38:34Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![reichtiger](https://discourse.vtk.org/user_avatar/discourse.vtk.org/reichtiger/32/3671_2.png) [@reichtiger](https://discourse.vtk.org/u/reichtiger)
#### Post date: [February 23, 2022, 1:38am UTC](https://discourse.vtk.org/t/build-vtk-9-1-0-to-webassembly/7895/1 "2022-02-23T01:38:34Z")

</div>

Hello,  
Nice to update to VTK-9.1.0 on Windows11 .

But when I compile it via dockcross/web-wasm:20220202, it raise error like below 😉

/VTK-9.1.0/Rendering/ContextOpenGL2/vtkOpenGLContextBufferId.cxx:142:21: error: use of undeclared identifier ‘GL\_DRAW\_BUFFER’  
glGetIntegerv(GL\_DRAW\_BUFFER, &savedDrawBuffer);

* * *

the cmake command is :  
cmake  
-DCMAKE\_TOOLCHAIN\_FILE=${CMAKE\_TOOLCHAIN\_FILE}  
-DBUILD\_SHARED\_LIBS:BOOL=OFF  
-DCMAKE\_BUILD\_TYPE:STRING=Release  
-DVTK\_ENABLE\_LOGGING:BOOL=OFF  
-DVTK\_ENABLE\_WRAPPING:BOOL=OFF  
-DVTK\_LEGACY\_REMOVE:BOOL=ON  
-DVTK\_OPENGL\_USE\_GLES:BOOL=ON  
-DVTK\_USE\_SDL2:BOOL=ON  
-DVTK\_NO\_PLATFORM\_SOCKETS:BOOL=ON  
-DVTK\_MODULE\_ENABLE\_VTK\_hdf5:STRING=NO  
…/…/apps/VTK-9.1.0 && cmake --build .

sometimes I use ninja -j 16 and the error is the same.

Any reply will be very appreciated ! Thanks in advance!  
William

---

<div class="post-metadata">

### Author: ![ken-martin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ken-martin/32/884_2.png) [@ken-martin](https://discourse.vtk.org/u/ken-martin)
#### Post date: [February 24, 2022, 3:40pm UTC](https://discourse.vtk.org/t/build-vtk-9-1-0-to-webassembly/7895/2 "2022-02-24T15:40:04Z")

</div>

I think we just haven’t used the context toolkit in webasm yet. It probably needs to be ifdef’d out and when ifdef’d out always assume GL\_BACK\_LEFT

---

<div class="post-metadata">

### Author: ![ken-martin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ken-martin/32/884_2.png) [@ken-martin](https://discourse.vtk.org/u/ken-martin)
#### Post date: [February 24, 2022, 3:47pm UTC](https://discourse.vtk.org/t/build-vtk-9-1-0-to-webassembly/7895/3 "2022-02-24T15:47:38Z")

</div>

e.g. something like

```auto
    GLint attachment = GL_BACK_LEFT;
#ifdef GL_DRAW_BUFFER
    glGetIntegerv(GL_DRAW_BUFFER, &attachment);
#endif

```

etc

---

<div class="post-metadata">

### Author: ![reichtiger](https://discourse.vtk.org/user_avatar/discourse.vtk.org/reichtiger/32/3671_2.png) [@reichtiger](https://discourse.vtk.org/u/reichtiger)
#### Post date: [March 10, 2022, 2:20am UTC](https://discourse.vtk.org/t/build-vtk-9-1-0-to-webassembly/7895/4 "2022-03-10T02:20:16Z")

</div>

Many Thanks !  
I have resolved this by set OPENGL=DONT\_WANT . 🙂

---

<div class="post-metadata">

### Author: ![andaji](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@andaji](https://discourse.vtk.org/u/andaji)
#### Post date: [May 12, 2022, 2:03pm UTC](https://discourse.vtk.org/t/build-vtk-9-1-0-to-webassembly/7895/5 "2022-05-12T14:03:26Z")

</div>

Could you show me how to add OPENGL=DONT\_WANT ?  
I add -DVTK\_MODULE\_ENABLE\_VTK\_opengl:STRING=DONT\_WANT , but still has the same error.

---

<div class="post-metadata">

### Author: ![andaji](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@andaji](https://discourse.vtk.org/u/andaji)
#### Post date: [May 12, 2022, 2:09pm UTC](https://discourse.vtk.org/t/build-vtk-9-1-0-to-webassembly/7895/6 "2022-05-12T14:09:20Z")

</div>

@reichtiger

---

<div class="post-metadata">

### Author: ![andaji](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@andaji](https://discourse.vtk.org/u/andaji)
#### Post date: [May 12, 2022, 2:37pm UTC](https://discourse.vtk.org/t/build-vtk-9-1-0-to-webassembly/7895/7 "2022-05-12T14:37:38Z")

</div>

@Sebastien_Jourdain I used ccmake and set OPENGL\_GLES2\_INCLUDE\_DIR and OPENGL\_GLES3\_INCLUDE\_DIR with a absolute path

```
 /Users/andaji/Mine/GithubCodes/emsdk/upstream/emscripten/system/include,

```

but still has the error.

😰 I’m sorry that, because new users are temporarily limited to 3 replies in the same topic. So I edit this to reply you.

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [May 12, 2022, 4:55pm UTC](https://discourse.vtk.org/t/build-vtk-9-1-0-to-webassembly/7895/8 "2022-05-12T16:55:56Z")

</div>

Use **ccmake** to prevent guess work on the command line.

---

<div class="post-metadata">

### Author: ![andaji](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@andaji](https://discourse.vtk.org/u/andaji)
#### Post date: [May 29, 2022, 1:05pm UTC](https://discourse.vtk.org/t/build-vtk-9-1-0-to-webassembly/7895/9 "2022-05-29T13:05:11Z")

</div>

I’m new in VTK and webassembly. Can you show me the detail configration of cmake ? 😰
