From d403060cf2362c06b6a4e82cbb86c1d59a9041fe Mon Sep 17 00:00:00 2001 From: Jon Rood Date: Mon, 7 Apr 2025 11:05:41 -0600 Subject: [PATCH] trilinos: patch version 16.1.0 to build on MacOS. (#49811) --- .../trilinos/16-1-0-stk-fpe-exceptions.patch | 122 ++++++++++++++++++ .../builtin/packages/trilinos/package.py | 3 + 2 files changed, 125 insertions(+) create mode 100644 var/spack/repos/builtin/packages/trilinos/16-1-0-stk-fpe-exceptions.patch diff --git a/var/spack/repos/builtin/packages/trilinos/16-1-0-stk-fpe-exceptions.patch b/var/spack/repos/builtin/packages/trilinos/16-1-0-stk-fpe-exceptions.patch new file mode 100644 index 00000000000..7470a720000 --- /dev/null +++ b/var/spack/repos/builtin/packages/trilinos/16-1-0-stk-fpe-exceptions.patch @@ -0,0 +1,122 @@ +diff --git a/packages/stk/stk_util/stk_util/util/FPExceptions.hpp b/packages/stk/stk_util/stk_util/util/FPExceptions.hpp +index e2f94a533d0..b539aa8a7dd 100644 +--- a/packages/stk/stk_util/stk_util/util/FPExceptions.hpp ++++ b/packages/stk/stk_util/stk_util/util/FPExceptions.hpp +@@ -14,7 +14,7 @@ + namespace stk { + namespace util { + +-constexpr bool have_errno() ++inline bool have_errno() + { + #ifdef STK_HAVE_FP_ERRNO + return math_errhandling & MATH_ERRNO; +@@ -23,7 +23,7 @@ constexpr bool have_errno() + #endif + } + +-constexpr bool have_errexcept() ++inline bool have_errexcept() + { + #ifdef STK_HAVE_FP_EXCEPT + return math_errhandling & MATH_ERREXCEPT; +@@ -38,7 +38,7 @@ std::string get_fe_except_string(int fe_except_bitmask); + + inline void clear_fp_errors() + { +- if constexpr (have_errexcept()) ++ if (have_errexcept()) + { + // experimental results show calling std::feclearexcept is *very* + // expensive, so dont call it unless needed. +@@ -46,7 +46,7 @@ inline void clear_fp_errors() + { + std::feclearexcept(FE_EXCEPT_CHECKS); + } +- } else if constexpr (have_errno()) ++ } else if (have_errno()) + { + errno = 0; + } +@@ -54,7 +54,7 @@ inline void clear_fp_errors() + + inline void throw_or_warn_on_fp_error(const char* fname = nullptr, bool warn=false, std::ostream& os = std::cerr) + { +- if constexpr (have_errexcept()) ++ if (have_errexcept()) + { + int fe_except_bitmask = std::fetestexcept(FE_EXCEPT_CHECKS); + if (fe_except_bitmask != 0) +@@ -68,7 +68,7 @@ inline void throw_or_warn_on_fp_error(const char* fname = nullptr, bool warn=fal + STK_ThrowRequireMsg(fe_except_bitmask == 0, msg); + } + } +- } else if constexpr (have_errno()) ++ } else if (have_errno()) + { + if (errno != 0) + { +diff --git a/packages/stk/stk_util/stk_util/util/PairIter.hpp b/packages/stk/stk_util/stk_util/util/PairIter.hpp +index e468dfff0af..edc9b62f1be 100644 +--- a/packages/stk/stk_util/stk_util/util/PairIter.hpp ++++ b/packages/stk/stk_util/stk_util/util/PairIter.hpp +@@ -35,6 +35,7 @@ + #ifndef stk_util_util_PairIter_hpp + #define stk_util_util_PairIter_hpp + ++#include + #include + #include + +diff --git a/packages/stk/stk_util/stk_util/util/ReportHandler.hpp b/packages/stk/stk_util/stk_util/util/ReportHandler.hpp +index e7ed6ca6b23..c632361a3a6 100644 +--- a/packages/stk/stk_util/stk_util/util/ReportHandler.hpp ++++ b/packages/stk/stk_util/stk_util/util/ReportHandler.hpp +@@ -40,7 +40,6 @@ + #include // for operator+, allocator, string, char_traits + #include + +-#include "stk_util/diag/String.hpp" + #include "stk_util/stk_kokkos_macros.h" // for STK_FUNCTION + + #ifdef STK_ENABLE_GPU_BUT_NO_RDC +@@ -266,7 +265,7 @@ class is_valid_throw_condition + + public: + static constexpr bool value = +- !is_same_as_any::value && !is_string_literal::value; ++ !is_same_as_any::value && !is_string_literal::value; + }; + template + inline auto eval_test_condition(const T& val) +diff --git a/packages/stk/stk_util/stk_util/util/concat_variable_name.cpp b/packages/stk/stk_util/stk_util/util/concat_variable_name.cpp +index c322a06fd41..a6fecf922be 100644 +--- a/packages/stk/stk_util/stk_util/util/concat_variable_name.cpp ++++ b/packages/stk/stk_util/stk_util/util/concat_variable_name.cpp +@@ -34,7 +34,6 @@ + + #include "stk_util/util/concat_variable_name.hpp" + #include // for size_t +-#include "stk_util/util/ReportHandler.hpp" + + namespace stk { + namespace util { +@@ -60,6 +59,5 @@ namespace util { + return false; + } + } +- + } + } +diff --git a/packages/stk/stk_util/stk_util/util/concat_variable_name.hpp b/packages/stk/stk_util/stk_util/util/concat_variable_name.hpp +index 997accb9943..73eb2ae9b36 100644 +--- a/packages/stk/stk_util/stk_util/util/concat_variable_name.hpp ++++ b/packages/stk/stk_util/stk_util/util/concat_variable_name.hpp +@@ -36,7 +36,6 @@ + #define STK_UTIL_UTIL_CONCAT_VARIABLE_NAME_H + + #include // for string +-#include + namespace stk { + namespace util { + /*! diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py index 9a95a8df89b..58a180b15a9 100644 --- a/var/spack/repos/builtin/packages/trilinos/package.py +++ b/var/spack/repos/builtin/packages/trilinos/package.py @@ -554,6 +554,9 @@ class Trilinos(CMakePackage, CudaPackage, ROCmPackage): # https://github.com/trilinos/Trilinos/pull/11600 patch("13.4.1-patch11600.patch", when="@13.4.1 %oneapi@2025:") + # https://github.com/trilinos/Trilinos/pull/13921 + patch("16-1-0-stk-fpe-exceptions.patch", when="@=16.1.0 +stk platform=darwin") + def flag_handler(self, name, flags): spec = self.spec is_cce = spec.satisfies("%cce")