# Build failure due to VTK\_EXTRA\_COMPILER\_WARNINGS=ON

**URL:** https://discourse.vtk.org/t/build-failure-due-to-vtk-extra-compiler-warnings-on/10533
**Category:** Development
**Created:** [January 24, 2023, 5:54pm UTC](https://discourse.vtk.org/t/build-failure-due-to-vtk-extra-compiler-warnings-on/10533 "2023-01-24T17:54:06Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![waebbl](https://discourse.vtk.org/user_avatar/discourse.vtk.org/waebbl/32/5870_2.png) [@waebbl](https://discourse.vtk.org/u/waebbl)
#### Post date: [January 24, 2023, 5:54pm UTC](https://discourse.vtk.org/t/build-failure-due-to-vtk-extra-compiler-warnings-on/10533/1 "2023-01-24T17:54:06Z")

</div>

Hello,

I received a bug report[1] where a debug build failed in `vtkioss/Ioss_Compare.C`. On Gentoo Linux we still use `CMAKE_BUILD_TYPE=RelWithDebInfo` for debug builds and let the user choose most of the parameters needed for a proper debug build, like compiler flags, not stripping or extraction of debug files. The package only passes some debug related cmake options to the build. The complete build log can be found attached to the bug.  
Testing the various options passed by the package configuration, I noticed that the `VTK_EXTRA_COMPILER_WARNINGS` is the actual option which causes this particular build failure. The build breaks with gcc-11 and gcc-12, I haven’t tested any other compilers or gcc versions.

[1] [891829 – sci-libs/vtk-9.2.5 fails to compile: Ioss\_Sort.h:138:5: error: "USE\_STD\_SORT" is not defined, evaluates to 0 [-Werror=undef]](https://bugs.gentoo.org/891829)

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [January 24, 2023, 10:41pm UTC](https://discourse.vtk.org/t/build-failure-due-to-vtk-extra-compiler-warnings-on/10533/2 "2023-01-24T22:41:00Z")

</div>

Hi,

It’s likely being triggered by enabling that option, which likely does a `-Wundef` (using undefined symbols in macros becomes a warning). That, combined with a `-Werror`, is promoted to a compilation error.

If you still do need `VTK_EXTRA_COMPILER_WARNINGS` you can try disabling warnings for system headers (I assume the offending `loss_Sort.h` belongs to a system library), by adding a compiler flag:

- For GCC-like compilers: `-isystem <path of a dependency include path>`.
- For MSVC: `/external:I <path of a dependency include path>` .

Those flags disable warnings coming from headers of libraries you’re using in your project. Hopefully you will get rid of that external header warning/error.

take care,

Paulo

---

<div class="post-metadata">

### Author: ![waebbl](https://discourse.vtk.org/user_avatar/discourse.vtk.org/waebbl/32/5870_2.png) [@waebbl](https://discourse.vtk.org/u/waebbl)
#### Post date: [January 25, 2023, 6:04am UTC](https://discourse.vtk.org/t/build-failure-due-to-vtk-extra-compiler-warnings-on/10533/3 "2023-01-25T06:04:11Z")

</div>

Hi Paulo,

thanks for your answer. Yes it is triggered by this option, I verified it.

> [@waebbl](#):
>
> Testing the various options passed by the package configuration, I noticed that the `VTK_EXTRA_COMPILER_WARNINGS` is the actual option which causes this particular build failure.

Enabling this option adds `-Werror=undef` to CMAKE\_CXX\_FLAGS from `CMake/vtkCompilerExtraFlags.cmake` for GNU compilers.

On Gentoo we don’t have a package for ioss, so this issue is related to the code provided with VTK in `ThirdParty/ioss/vtkioss`.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [January 25, 2023, 6:49pm UTC](https://discourse.vtk.org/t/build-failure-due-to-vtk-extra-compiler-warnings-on/10533/4 "2023-01-25T18:49:21Z")

</div>

Hello,

If you don’t have IOSS in your platform, then I believe you should disable `VTK_MODULE_ENABLE_VTK_IOIOSS`, `VTK_MODULE_ENABLE_VTK_ioss` and `VTK_MODULE_USE_EXTERNAL_VTKioss` in CMake.

best,

Paulo

---

<div class="post-metadata">

### Author: ![waebbl](https://discourse.vtk.org/user_avatar/discourse.vtk.org/waebbl/32/5870_2.png) [@waebbl](https://discourse.vtk.org/u/waebbl)
#### Post date: [January 26, 2023, 6:05am UTC](https://discourse.vtk.org/t/build-failure-due-to-vtk-extra-compiler-warnings-on/10533/5 "2023-01-26T06:05:55Z")

</div>

Hello,

I already had the `VTK_MODULE_USE_EXTERNAL_VTKioss` set to OFF. Adding the other two options let the build finish with `VTK__EXTRA_COMPILER_WARNINGS=ON`.  
Yet, I still think, that it is a bug in VTK. The build shouldn’t just succeed if the user provides some specific configuration settings. VTK provides a bundled ioss library and sets the options for it to `DEFAULT` if not specified otherwise, so other modules can trigger the build if they need this module. So it should finish the build with these settings, shouldn’t it?  
Also, eventually someone might need to have the IOIOSS IO module for loading files provided by ioss from another machine, but doesn’t need to have ioss installed on their machine, so disabling the settings wouldn’t be an option.

regards,  
Bernd

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [January 26, 2023, 1:19pm UTC](https://discourse.vtk.org/t/build-failure-due-to-vtk-extra-compiler-warnings-on/10533/6 "2023-01-26T13:19:56Z")

</div>

> [@waebbl](#):
>
> The build shouldn’t just succeed if the user provides some specific configuration settings.

Why not? If you don’t want the ioss feature in your build, that shouldn’t be a problem.

But if you still think it is a VTK bug, you can report it here: [https://gitlab.kitware.com/vtk/vtk/-/issues](https://gitlab.kitware.com/vtk/vtk/-/issues)

take care,

Paulo

---

<div class="post-metadata">

### Author: ![waebbl](https://discourse.vtk.org/user_avatar/discourse.vtk.org/waebbl/32/5870_2.png) [@waebbl](https://discourse.vtk.org/u/waebbl)
#### Post date: [January 27, 2023, 10:21am UTC](https://discourse.vtk.org/t/build-failure-due-to-vtk-extra-compiler-warnings-on/10533/7 "2023-01-27T10:21:48Z")

</div>

> [@Paulo\_Carvalho](#):
>
> Why not?

Because it’s the job of the developers to take measures that doesn’t allow _invalid_ input, i.e. configurations and not the users jobs to test whether a certain configuration is valid and leads to a sucessfull and working build?

> [@Paulo\_Carvalho](#):
>
> But if you still think it is a VTK bug, you can report it here: [https://gitlab.kitware.com/vtk/vtk/-/issues](https://gitlab.kitware.com/vtk/vtk/-/issues)

Thanks, I know this page, but wanted to talk about the issue here first, before opening a bug. I go and report it there then.

Best,  
Bernd

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [January 27, 2023, 3:10pm UTC](https://discourse.vtk.org/t/build-failure-due-to-vtk-extra-compiler-warnings-on/10533/8 "2023-01-27T15:10:00Z")

</div>

> [@waebbl](#):
>
> Because it’s the job of the developers to take measures that doesn’t allow _invalid_ input,

Look, VTK is an open source project. If you found a bug, you either report it in full detail or you get involved and contribute to the community by solving it yourself. Here’s an example of a bug that is affecting me: [https://gitlab.kitware.com/vtk/vtk/-/issues/18503](https://gitlab.kitware.com/vtk/vtk/-/issues/18503). There, I provided a tweak to VTK source code to patch it while the fix ([https://gitlab.kitware.com/vtk/vtk/-/merge\_requests/9125](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9125)) doesn’t make it downstream.

Now, if you own a business and need it fixed ASAP, you can hire Kitware or some other developer do it for you. Your call.

best,

Paulo

---

<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: [January 27, 2023, 3:22pm UTC](https://discourse.vtk.org/t/build-failure-due-to-vtk-extra-compiler-warnings-on/10533/9 "2023-01-27T15:22:29Z")

</div>

Hi @waebbl

Indeed, if you found a bug, please open an issue.

Best,

---

<div class="post-metadata">

### Author: ![waebbl](https://discourse.vtk.org/user_avatar/discourse.vtk.org/waebbl/32/5870_2.png) [@waebbl](https://discourse.vtk.org/u/waebbl)
#### Post date: [January 28, 2023, 8:12am UTC](https://discourse.vtk.org/t/build-failure-due-to-vtk-extra-compiler-warnings-on/10533/10 "2023-01-28T08:12:22Z")

</div>

> [@Paulo\_Carvalho](#):
>
> Look, VTK is an open source project. If you found a bug, you either report it in full detail or you get involved and contribute to the community by solving it yourself.

I’m fully aware of all these. The only thing, I wanted to achieve here is a possible exploration of the issue from more people for me to decide whether it really is a bug or not. You know, 2 eyes usually see less, than 2^n eyes. So far, your line of argumentation couldn’t convince me that it’s not a bug. Yet, I think it leads nowhere to continue the discussion in the direction it was going, so I opened a bug report.

> [@mwestphal](#):
>
> Indeed, if you found a bug, please open an issue

Thanks @mwestphal, already done in [https://gitlab.kitware.com/vtk/vtk/-/issues/18798](https://gitlab.kitware.com/vtk/vtk/-/issues/18798)
