Repository: spack/spack

Issue:
Installation issue: `vtk@9%gcc14`
### Steps to reproduce the issue

Building `vtk@9.2.6%gcc@14` fails

```
/home/chm003/project/spack/stage/spack-stage-vtk-9.2.6-g7i4jxcoeaxkii6w4kiduq2pldj7e6zl/spack-src/IO/Image/vtkSEPReader.h:33:6: warning: elaborated-type-specifier for a scoped enum must not use the 'class' keyword
   33 | enum class EndiannessType : std::uint8_t
      | ~~~~ ^~~~~
      |      -----
/home/chm003/project/spack/stage/spack-stage-vtk-9.2.6-g7i4jxcoeaxkii6w4kiduq2pldj7e6zl/spack-src/IO/Image/vtkSEPReader.h:33:12: error: use of enum 'EndiannessType' without previous declaration
   33 | enum class EndiannessType : std::uint8_t
```

and this is known problem 
https://gitlab.kitware.com/vtk/vtk/-/issues/18782
kitware has backported a fix
https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9996
that resolves this.

I have a PR with the patch applied in progress.

### Error message

<details><summary>Error message</summary>

<pre>
/home/chm003/project/spack/stage/spack-stage-vtk-9.2.6-g7i4jxcoeaxkii6w4kiduq2pldj7e6zl/spack-src/IO/Image/vtkSEPReader.h:33:6: warning: elaborated-type-specifier for a scoped enum must not use the 'class' keyword
   33 | enum class EndiannessType : std::uint8_t
      | ~~~~ ^~~~~
      |      -----
/home/chm003/project/spack/stage/spack-stage-vtk-9.2.6-g7i4jxcoeaxkii6w4kiduq2pldj7e6zl/spack-src/IO/Image/vtkSEPReader.h:33:12: error: use of enum 'EndiannessType' without previous declaration
   33 | enum class EndiannessType : std::uint8_t
</pre></details>


### Information on your system

```
spack debug report
* **Spack:** 0.23.0.dev0 (3f472039c55cd7a5d73fb0b0bf63317669733e8a)
* **Python:** 3.12.3
* **Platform:** darwin-sonoma-m1
* **Concretizer:** clingo
```

### Additional information

@chuckatkins  @danlipsa
/cc @johnwparent 

### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate
Installation issue: `vtk@9%gcc14`
### Steps to reproduce the issue

Building `vtk@9.2.6%gcc@14` fails

```
/home/chm003/project/spack/stage/spack-stage-vtk-9.2.6-g7i4jxcoeaxkii6w4kiduq2pldj7e6zl/spack-src/IO/Image/vtkSEPReader.h:33:6: warning: elaborated-type-specifier for a scoped enum must not use the 'class' keyword
   33 | enum class EndiannessType : std::uint8_t
      | ~~~~ ^~~~~
      |      -----
/home/chm003/project/spack/stage/spack-stage-vtk-9.2.6-g7i4jxcoeaxkii6w4kiduq2pldj7e6zl/spack-src/IO/Image/vtkSEPReader.h:33:12: error: use of enum 'EndiannessType' without previous declaration
   33 | enum class EndiannessType : std::uint8_t
```

and this is known problem 
https://gitlab.kitware.com/vtk/vtk/-/issues/18782
kitware has backported a fix
https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9996
that resolves this.

I have a PR with the patch applied in progress.

### Error message

<details><summary>Error message</summary>

<pre>
/home/chm003/project/spack/stage/spack-stage-vtk-9.2.6-g7i4jxcoeaxkii6w4kiduq2pldj7e6zl/spack-src/IO/Image/vtkSEPReader.h:33:6: warning: elaborated-type-specifier for a scoped enum must not use the 'class' keyword
   33 | enum class EndiannessType : std::uint8_t
      | ~~~~ ^~~~~
      |      -----
/home/chm003/project/spack/stage/spack-stage-vtk-9.2.6-g7i4jxcoeaxkii6w4kiduq2pldj7e6zl/spack-src/IO/Image/vtkSEPReader.h:33:12: error: use of enum 'EndiannessType' without previous declaration
   33 | enum class EndiannessType : std::uint8_t
</pre></details>


### Information on your system

```
spack debug report
* **Spack:** 0.23.0.dev0 (3f472039c55cd7a5d73fb0b0bf63317669733e8a)
* **Python:** 3.12.3
* **Platform:** darwin-sonoma-m1
* **Concretizer:** clingo
```

### Additional information

@chuckatkins  @danlipsa
/cc @johnwparent 

### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/vtk/package.py b/var/spack/repos/builtin/packages/vtk/package.py
--- a/var/spack/repos/builtin/packages/vtk/package.py
+++ b/var/spack/repos/builtin/packages/vtk/package.py
@@ -209,6 +209,14 @@ class Vtk(CMakePackage):
         when="@9.1",
     )
 
+    # vtk@9 does not compile with gcc 13 or 14
+    # https://gitlab.kitware.com/vtk/vtk/-/issues/18782
+    patch(
+        "https://gitlab.kitware.com/vtk/vtk/-/merge_requests/9996.diff",
+        sha256="dab51ffd0d62b00c089c1245e6b105f740106b53893305c87193d4ba03a948e0",
+        when="@9.1:9.2 %gcc@13:",
+    )
+
     @when("@9.2:")
     def patch(self):
         # provide definition for Ioss::Init::Initializer::Initializer(),


Test patch: