# Minimal VTK build with new module system

**URL:** https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813
**Category:** Support
**Created:** [March 12, 2020, 5:12pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813 "2020-03-12T17:12:51Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![biagas](https://discourse.vtk.org/user_avatar/discourse.vtk.org/biagas/32/7380_2.png) [@biagas](https://discourse.vtk.org/u/biagas)
#### Post date: [March 12, 2020, 5:12pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/1 "2020-03-12T17:12:52Z")

</div>

With vtk-8.1, Disabling groups and enabling only those modules needed was pretty straightforward to get only the desired pieces of vtk. Dependent modules of those requested were automagically also enabled.

I downloaded master and am confused by the new 5-state modules.  
I turned off groups, and set the state of desired modules to ‘YES’. It seems dependent modules are no longer automatically enabled. For instance, I enabled CommonCore, IOGeometry but get CMake errors that IOGeoemtry requires CommonExecutionModel and CommonSystem. ( I didn’t need to explicitly enable them in vtk-8.1).

I started down the path of enabling the dependencies, but wonder if there is a better way to get behavior similar to 8.1, where I only need to request the higher level modules I know I need, without also needing to know about and enable all the dependent modules, too?

---

<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: [March 12, 2020, 6:02pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/2 "2020-03-12T18:02:16Z")

</div>

If you want dependencies enabled as needed, use `DONT_WANT` for those you don’t care about, not `NO`. The issue with the old system was that if you _didn’t_ want a feature enabled, it was hard to ensure that was the case (extra dependencies or something) since dependencies got silently enabled. The `NO` state ensures that such modules are not built at all. That’s the error you’re encountering.

This is documented in the [build documentation](https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/build.md) for VTK (suggestions on making that more discoverable is welcome).

---

<div class="post-metadata">

### Author: ![biagas](https://discourse.vtk.org/user_avatar/discourse.vtk.org/biagas/32/7380_2.png) [@biagas](https://discourse.vtk.org/u/biagas)
#### Post date: [March 12, 2020, 6:13pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/3 "2020-03-12T18:13:54Z")

</div>

Thank you, especially for the link.

I didn’t change any modules settings except those I wanted. I changed them to ‘Yes’. All other module settings appear to be ‘DEFAULT’. Are you saying I need to change all the other module settings to DONT\_WANT? If so, that seems strange, because then I would also need to know about all the module names, and will make for a very large cmake command line when trying to script the build process.

---

<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: [March 12, 2020, 7:26pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/4 "2020-03-12T19:26:02Z")

</div>

`DEFAULT` is either `WANT` or `DONT_WANT` based on the `VTK_BUILD_ALL_MODULES` setting.

There are some settings which force modules off. For example, if you say `VTK_WRAP_PYTHON=OFF`, you will no longer get wrapping enabled just because you asked for the `RenderingMatplotlib` module. Other flags act similarly in that if they are off, the feature is _not_ available. You may be running into that, but I don’t suspect so.

What’s the full set of flags you’re passing to the initial configure?

---

<div class="post-metadata">

### Author: ![biagas](https://discourse.vtk.org/user_avatar/discourse.vtk.org/biagas/32/7380_2.png) [@biagas](https://discourse.vtk.org/u/biagas)
#### Post date: [March 12, 2020, 8:05pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/5 "2020-03-12T20:05:27Z")

</div>

BUILD\_SHARED\_LIBS=true  
VTK\_BUILD\_TESTING=false  
VTK\_BUILD\_DOCUMENTATION=false  
VTK\_REPORT\_OPENGL\_ERRORS=true  
VTK\_ALL\_NEW\_OBJECT\_FACTORY=true

VTK\_GROUP\_ENABLE\_Imaging=NO  
VTK\_GROUP\_ENABLE\_MPI=NO  
VTK\_GROUP\_ENABLE\_Qt=NO  
VTK\_GROUP\_ENABLE\_Rendering=NO  
VTK\_GROUP\_ENABLE\_StandAlone=NO  
VTK\_GROUP\_ENABLE\_Views=NO  
VTK\_GROUP\_ENABLE\_Web=NO

VTK\_MODULE\_ENABLE\_CommonCore=YES  
VTK\_MODULE\_ENABLE\_FiltersFlowPaths=YES  
VTK\_MODULE\_ENABLE\_FiltersHybrid=YES  
VTK\_MODULE\_ENABLE\_FiltersModeling=YES  
VTK\_MODULE\_ENABLE\_GeovisCore=YES  
VTK\_MODULE\_ENABLE\_IOEnSight=YES  
VTK\_MODULE\_ENABLE\_IOGeometry=YES  
VTK\_MODULE\_ENABLE\_IOLegacy=YES  
VTK\_MODULE\_ENABLE\_Module\_vtkIOPLY=YES  
VTK\_MODULE\_ENABLE\_IOXML=YES  
VTK\_MODULE\_ENABLE\_InteractionStyle=YES  
VTK\_MODULE\_ENABLE\_RenderingAnnotation=YES  
VTK\_MODULE\_ENABLE\_RenderingFreeType=YES  
VTK\_MODULE\_ENABLE\_RenderingOpenGL2=YES  
VTK\_MODULE\_ENABLE\_libxml2=YES

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [March 12, 2020, 8:16pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/6 "2020-03-12T20:16:28Z")

</div>

@ben.boeckel this 5-state system is really confusing. It would be so much better to have just ON/OFF state as in every other CMake project. When there is a dependency issue, you can show an error message to the user, such as _“X module is set to ON but required Y, W, Z modules are set to OFF. Please set module X to OFF or set Y, W, Z modules to ON.”_ This works well for us in other library where we have complex dependencies between dozens of components.

When you first configure the project, you may get a few of these questions, but these questions are very valuable: they inform developers about decisions that they have to make and allow them to decide for themselves. It is a very simple, transparent mechanism. Answering a few important questions is much less annoying than battling with some automatic rule engine, trying to reverse-engineer the hidden dependencies and guess what could be the impact of changing the state of a module (which may enable or disable a whole set of other modules without knowledge or consent of the developer).

---

<div class="post-metadata">

### Author: ![biagas](https://discourse.vtk.org/user_avatar/discourse.vtk.org/biagas/32/7380_2.png) [@biagas](https://discourse.vtk.org/u/biagas)
#### Post date: [March 12, 2020, 9:02pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/7 "2020-03-12T21:02:55Z")

</div>

With the above settings, the first error I see is this:  
CMake Error at CMake/vtkModule.cmake:953 (message):  
The VTK::IOGeometry module requires the disabled module  
VTK::CommonExecutionModel.  
Call Stack (most recent call first):  
CMakeLists.txt:253 (vtk\_module\_scan)

If I proceed to enable each disabled module (by changing its state to YES) as they are called out by the cmake process, I end up having to enable all kinds of modules I do not want, especially parallel modules.

Am I missing something important with the new process?

---

<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: [March 13, 2020, 1:10pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/8 "2020-03-13T13:10:24Z")

</div>

> [@biagas](#):
>
> VTK\_GROUP\_ENABLE\_Imaging=NO  
> VTK\_GROUP\_ENABLE\_MPI=NO  
> VTK\_GROUP\_ENABLE\_Qt=NO  
> VTK\_GROUP\_ENABLE\_Rendering=NO  
> VTK\_GROUP\_ENABLE\_StandAlone=NO  
> VTK\_GROUP\_ENABLE\_Views=NO  
> VTK\_GROUP\_ENABLE\_Web=NO

Use `DONT_WANT` here. The values for groups is the same as modules.

---

<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: [March 13, 2020, 1:13pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/9 "2020-03-13T13:13:23Z")

</div>

> [@lassoan](#):
>
> this 5-state system is really confusing. It would be so much better to have just ON/OFF state as in every other CMake project. When there is a dependency issue, you can show an error message to the user, such as _“X module is set to ON but required Y, W, Z modules are set to OFF. Please set module X to OFF or set Y, W, Z modules to ON.”_ This works well for us in other library where we have complex dependencies between dozens of components.

I don’t disagree that it can be confusing. However, I suspect that you’re underestimating the number of reconfigures you’re going to need to flush out the dependency errors. With only 2 states, you’ll basically have to manually enable the entire dep tree for what you want (or we lose the way to say the valuable “this build must _not_ have Python” (or MPI, or other feature) configuration).

The better solution for this is, IMO, to split VTK into smaller projects that are more focused. They can live in the same repo, but a single build with 100+ optional libraries is never going to be easy to configure.

---

<div class="post-metadata">

### Author: ![pieper](https://discourse.vtk.org/user_avatar/discourse.vtk.org/pieper/32/17_2.png) [@pieper](https://discourse.vtk.org/u/pieper)
#### Post date: [March 13, 2020, 1:37pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/10 "2020-03-13T13:37:35Z")

</div>

> [@ben.boeckel](#):
>
> The better solution for this is, IMO, to split VTK into smaller projects that are more focused.

Yes please!

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [March 13, 2020, 2:47pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/11 "2020-03-13T14:47:50Z")

</div>

I fully agree that stripping down VTK core and moving out most modules to separate projects, (which could be individually hosted, developed, built, and Python-wrapped) would solve many issues. If a number of VTK modules would be spun off to separate projects, but still maintained by Kitware, then that would ensure that a good infrastructure is developed and maintained (such as convenience CMake scripts in VTK core), which the community could use for creating their own VTK modules.

---

<div class="post-metadata">

### Author: ![biagas](https://discourse.vtk.org/user_avatar/discourse.vtk.org/biagas/32/7380_2.png) [@biagas](https://discourse.vtk.org/u/biagas)
#### Post date: [March 13, 2020, 3:29pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/12 "2020-03-13T15:29:36Z")

</div>

Thank you for the guidance. I started a fresh build attempt and used ‘DONT\_WANT’ for the group enable values and set the module values to ‘YES’ for those I wanted. I am still getting errors regarding disabled modules. The modules tagged as missing have values of ‘DEFAULT’  
Should I be using ‘WANT’ instead of ‘YES’?

I only get 1 error per invocation of cmake’s configure, so its a slow process working through the errors. Here are the first three I saw:

```auto
CMake Error at CMake/vtkModule.cmake:2343 (message):
  The VTK::RenderingContext2D dependency is missing for VTK::ChartsCore.

CMake Error at CMake/vtkModule.cmake:2343 (message):
  The VTK::octree dependency is missing for VTK::RenderingLabel.

CMake Error at CMake/vtkModule.cmake:2343 (message):
  The VTK::octree dependency is missing for VTK::RenderingLabel.

```

---

<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: [March 13, 2020, 4:32pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/13 "2020-03-13T16:32:57Z")

</div>

Passing `-DVTK_DEBUG_MODULE=all` will output more debugging information about why those modules aren’t available.

---

<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: [March 13, 2020, 4:36pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/14 "2020-03-13T16:36:00Z")

</div>

> [@lassoan](#):
>
> I fully agree that stripping down VTK core and moving out most modules to separate projects, (which could be individually hosted, developed, built, and Python-wrapped) would solve many issues.

Note that this vastly increases our release cycle burden and will mean that VTK _cannot_ break API without announcement and coordinated changesets. That’s going to be the tough pill to swallow for the development community because we are, on the whole, very fond of breaking API. The split-up-VTK thing is a goal I’d like to have, but I don’t think it’s anywhere close to being realized today. I have enough other things taking up my time, but adopting some of the more domain-specific modules into separate repositories would be a good first step others can take in a piecemeal way.

---

<div class="post-metadata">

### Author: ![biagas](https://discourse.vtk.org/user_avatar/discourse.vtk.org/biagas/32/7380_2.png) [@biagas](https://discourse.vtk.org/u/biagas)
#### Post date: [March 13, 2020, 5:05pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/15 "2020-03-13T17:05:26Z")

</div>

Here’s the VTK\_DEBUG\_MODULE output specifically related to the modules called out in the error message:

```auto
VTK module debug module: VTK::ChartsCore declared by C:/vtk-master/Charts/Core/vtk.module
VTK module debug enable: VTK::ChartsCore is DEFAULT, using group `StandAlone` setting: DONT_WANT
VTK module debug provide: VTK::ChartsCore is indeterminite (DONT_WANT)
VTK module debug provide: VTK::ChartsCore is provided due to dependency from VTK::CommonDataModel

VTK module debug module: VTK::RenderingContext2D declared by C:/vtk-master/Rendering/Context2D/vtk.module
VTK module debug enable: VTK::RenderingContext2D is DEFAULT, using group `Rendering` setting: DONT_WANT

VTK module debug kit: VTK::RenderingContext2D belongs to the VTK::Rendering kit

CMake Error at CMake/vtkModule.cmake:2343 (message):
  The VTK::RenderingContext2D dependency is missing for VTK::ChartsCore.
Call Stack (most recent call first):
  CMakeLists.txt:315 (vtk_module_build)

```

---

<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: [March 13, 2020, 10:31pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/16 "2020-03-13T22:31:38Z")

</div>

What ends up requiring `VTK::ChartsCore`? Is the topo sort wrong? Is it enabled by a test dependency (in which case, you’re hitting [https://gitlab.kitware.com/vtk/vtk/issues/17509](https://gitlab.kitware.com/vtk/vtk/issues/17509))?

---

<div class="post-metadata">

### Author: ![biagas](https://discourse.vtk.org/user_avatar/discourse.vtk.org/biagas/32/7380_2.png) [@biagas](https://discourse.vtk.org/u/biagas)
#### Post date: [March 13, 2020, 11:19pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/17 "2020-03-13T23:19:08Z")

</div>

The trigger appears to be the GeovisCore module. I removed it from my list of enabled modules in a fresh build and did not get the error. I’m using CMake-gui on WIndows 10. Is there a log file generated that I can upload? I tried to cut-n-paste just the module debug parts of cmake output but ran into the word limit.

---

<div class="post-metadata">

### Author: ![biagas](https://discourse.vtk.org/user_avatar/discourse.vtk.org/biagas/32/7380_2.png) [@biagas](https://discourse.vtk.org/u/biagas)
#### Post date: [March 13, 2020, 11:58pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/18 "2020-03-13T23:58:13Z")

</div>

Discovered the error on my part based on your comment regarding test dependency.  
I was trying to turn off testing by setting BUILD\_TESTING (old name for the var).  
I fixed it by using VTK\_BUILD\_TESTING at the same time as I removed GeovisCore module from the build. Sorry for the red herring.

I believe I have the situation under control now, by turning off VTK\_BUILD\_TESTING, using DONT\_WANT to turn off groups, and YES to turn on modules.

Thank you for your patience in helping me learn the new module system.

---

<div class="post-metadata">

### Author: ![phcerdan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/phcerdan/32/54_2.png) [@phcerdan](https://discourse.vtk.org/u/phcerdan)
#### Post date: [September 8, 2020, 12:23am UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/19 "2020-09-08T00:23:46Z")

</div>

@ben.boeckel how can we know the value of `DEFAULT` for a given module?

---

<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: [September 8, 2020, 1:45pm UTC](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813/20 "2020-09-08T13:45:04Z")

</div>

See the “Enabling modules for build” section in [the module system’s documentation](https://vtk.org/doc/nightly/html/md__home_kitware_dashboards_buildbot_vtk_nightly-master-ike-linux-shared-release_doc_nightly_osm749dd663df9981384f2598c108aac3b0.html).

[Next page](https://discourse.vtk.org/t/minimal-vtk-build-with-new-module-system/2813.md?page=2)
