Skip to content

Commit a4d442c

Browse files
authored
VTK: fix clang compatibility (spack#50117)
This is an implementation of the patches from Dimitry Andric described here to fix compatibility with vtk 9.2+ and clang 19+ derivative compilers including clang and apple-clang (and oneapi, but I have not tested). The patch is safe (afaik) to apply to non-clang compilers. I have split the original patch so each part can be applied individually. Patch 1: std::char_traits<> is now only provided for char, char8_t, char16_t, char32_t and wchar_t, and any instantiation for other types will fail. [...] This is actually a problem in the vendored version of Victor Zverovich's fmt library [2]. More recent versions of this library have completely rewritten this part of the header, so work around the issue by making the basic_string_view<char8_t> part conditional on char8_t being actually available. (This is only in C++20 and later.) This impacts vtk@9.2:9.4. Patch 2: There is also a typo that was fixed upstream in vtk 9.4+ that the clang compilers choke on. This is reported in spack#49623. This impacts vtk@9.2:9.3.
1 parent 4ae60f1 commit a4d442c

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

var/spack/repos/spack_repo/builtin/packages/vtk/package.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,17 @@ class Vtk(CMakePackage):
260260
when="@9.4:",
261261
)
262262

263+
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280893
264+
# incorrect member accesses fixed in 9.4
265+
# https://gitlab.kitware.com/vtk/vtk/-/commit/98af50ca33
266+
patch("vtk_patch_octree_m_children.patch", when="@9.2:9.3")
267+
268+
# clang 19+ no long providers std::char_traits<> for char8_t
269+
# impacts any clang derivative compiler. But can be patched
270+
# regardless of compiler
271+
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280893
272+
patch("vtk_clang19_size_t.patch", when="@9.2:9.4.2")
273+
263274
# Needed to build VTK with external SEACAS >= 2022-10-14
264275
@when("@9.4:")
265276
def patch(self):
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--- a/ThirdParty/diy2/vtkdiy2/include/vtkdiy2/fmt/format.h
2+
+++ b/ThirdParty/diy2/vtkdiy2/include/vtkdiy2/fmt/format.h
3+
@@ -480,6 +480,7 @@
4+
}
5+
} // namespace internal
6+
7+
+#ifdef __cpp_char8_t
8+
// A UTF-8 string view.
9+
class u8string_view : public basic_string_view<char8_t> {
10+
public:
11+
@@ -497,6 +498,7 @@
12+
}
13+
} // namespace literals
14+
#endif
15+
+#endif // __cpp_char8_t
16+
17+
// The number of characters to store in the basic_memory_buffer object itself
18+
// to avoid dynamic memory allocation.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/Utilities/octree/octree/octree_node.txx
2+
+++ b/Utilities/octree/octree/octree_node.txx
3+
@@ -207,7 +207,7 @@
4+
{
5+
throw std::domain_error("Attempt to access children of an octree leaf node.");
6+
}
7+
- return this->_M_chilren[child];
8+
+ return this->m_children[child];
9+
}
10+
11+
/**\brief Return a reference to a child node.

0 commit comments

Comments
 (0)