Build failure due to VTK_EXTRA_COMPILER_WARNINGS=ON

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]

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

Hi Paulo,

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

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.

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

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

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

take care,

Paulo

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?

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

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. There, I provided a tweak to VTK source code to patch it while the fix (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

1 Like

Hi @waebbl

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

Best,

1 Like

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.

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

1 Like