# Building VTK from Source with Modules

**URL:** https://discourse.vtk.org/t/building-vtk-from-source-with-modules/12608
**Category:** Support
**Created:** [November 2, 2023, 10:46pm UTC](https://discourse.vtk.org/t/building-vtk-from-source-with-modules/12608 "2023-11-02T22:46:50Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Hasnain\_Raza](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hasnain_raza/32/7943_2.png) [@Hasnain\_Raza](https://discourse.vtk.org/u/Hasnain_Raza)
#### Post date: [November 2, 2023, 10:46pm UTC](https://discourse.vtk.org/t/building-vtk-from-source-with-modules/12608/1 "2023-11-02T22:46:50Z")

</div>

I’m trying to build VTK from the source on Windows with three modules enabled. I got the source from [here](https://github.com/Kitware/VTK) and I’m enabling VTK::RenderingOpenGL2, VTK::RenderingOpenVR, and VTK::RenderingOpenXR.

The building process I followed used these commands:

```auto
cmake -DVTK_MODULE_ENABLE_VTK_RenderingOpenGL2=WANT -DVTK_MODULE_ENABLE_VTK_RenderingOpenVR=WANT -DVTK_MODULE_ENABLE_VTK_RenderingOpenXR=WANT -DOpenVR_INCLUDE_DIR:PATH='...' -DOpenVR_LIBRARY:FILEPATH='...' -DOpenVR_INCLUDE_DIR:PATH='...' -DOpenVR_LIBRARY:FILEPATH='...' -S . -B build

```

This configures the project and after this, I simply run:

```auto
cmake --build build

```

After about 40 or so minutes, the build completes, however, inside `build\lib\Debug` I don’t see any library from either of these modules. For example, for OpenGL, I was expecting `vtkRenderingContextOpenGL2-9.3d.lib`.

What is the problem here?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [November 6, 2023, 8:50am UTC](https://discourse.vtk.org/t/building-vtk-from-source-with-modules/12608/2 "2023-11-06T08:50:33Z")

</div>

Are you building on Windows ?

Does `...` Works on windows ?

Please share the complete compilation output.

---

<div class="post-metadata">

### Author: ![Hasnain\_Raza](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hasnain_raza/32/7943_2.png) [@Hasnain\_Raza](https://discourse.vtk.org/u/Hasnain_Raza)
#### Post date: [November 6, 2023, 1:37pm UTC](https://discourse.vtk.org/t/building-vtk-from-source-with-modules/12608/3 "2023-11-06T13:37:32Z")

</div>

I’m building on Windows. Sorry, I should have mentioned that I put the correct paths in the real command. Here, I have placed `...` for convenience. Compilation works successfully, however, `.lib` files for OpenGL, OpenVR, and OpenXR are not generated under the `lib` folder inside the `build` folder.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [November 6, 2023, 1:39pm UTC](https://discourse.vtk.org/t/building-vtk-from-source-with-modules/12608/4 "2023-11-06T13:39:37Z")

</div>

Please share the recursive content of `lib` and `bin` directory.

---

<div class="post-metadata">

### Author: ![Hasnain\_Raza](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hasnain_raza/32/7943_2.png) [@Hasnain\_Raza](https://discourse.vtk.org/u/Hasnain_Raza)
#### Post date: [November 6, 2023, 2:30pm UTC](https://discourse.vtk.org/t/building-vtk-from-source-with-modules/12608/5 "2023-11-06T14:30:07Z")

</div>

`lib` tree: [lib tree - Pastebin.com](https://pastebin.com/Zdv0TyQz)  
`bin` tree: [bin tree - Pastebin.com](https://pastebin.com/VKe56Qeh)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [November 7, 2023, 9:19am UTC](https://discourse.vtk.org/t/building-vtk-from-source-with-modules/12608/6 "2023-11-07T09:19:59Z")

</div>

Looks fine on my own build.

Please start from scratch and share the output of the cmake configuration of VTK.

---

<div class="post-metadata">

### Author: ![Hasnain\_Raza](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hasnain_raza/32/7943_2.png) [@Hasnain\_Raza](https://discourse.vtk.org/u/Hasnain_Raza)
#### Post date: [November 7, 2023, 5:48pm UTC](https://discourse.vtk.org/t/building-vtk-from-source-with-modules/12608/7 "2023-11-07T17:48:05Z")

</div>

Here is the log of configuring the build with CMake: [configlog.txt - Pastebin.com](https://pastebin.com/zTjcfJfH)

I built it again after this and the same issue is happening.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [November 8, 2023, 8:56am UTC](https://discourse.vtk.org/t/building-vtk-from-source-with-modules/12608/8 "2023-11-08T08:56:28Z")

</div>

try with `-DVTK_MODULE_ENABLE_VTK_RenderingOpenGL2=YES` ?

---

<div class="post-metadata">

### Author: ![Hasnain\_Raza](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hasnain_raza/32/7943_2.png) [@Hasnain\_Raza](https://discourse.vtk.org/u/Hasnain_Raza)
#### Post date: [November 8, 2023, 1:56pm UTC](https://discourse.vtk.org/t/building-vtk-from-source-with-modules/12608/9 "2023-11-08T13:56:03Z")

</div>

Same issue. What could be causing the build to not generate libraries for OpenGL, OpenVR, and OpenXR even though the configuration happens correctly (I believe according to the logs I shared)?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [November 8, 2023, 2:18pm UTC](https://discourse.vtk.org/t/building-vtk-from-source-with-modules/12608/10 "2023-11-08T14:18:19Z")

</div>

I’m afraid I have no idea. It is working well here. Maybe try with ninja instead of visual studio ?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [November 17, 2023, 3:52am UTC](https://discourse.vtk.org/t/building-vtk-from-source-with-modules/12608/11 "2023-11-17T03:52:27Z")

</div>

Using the `Ninja` generator is definitely recommended. You can also debug the module system with `-DVTK_DEBUG_MODULE=ON -DVTK_DEBUG_MODULE_ALL=ON`.

Note that the VS build may have a slight non-standard layout in the build tree. However, I see their `-hierarchy.txt` files, so they _are_ enabled. Did the build complete successfully? It seems that there’s probably a build failure somewhere.
