From 49c924f481e1151815f8ae7169e25a619042ed48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Mon, 9 Dec 2024 08:32:02 -0800 Subject: [PATCH] onnxruntime: fix compiler error The build used to fail with In file included from /build/source/onnxruntime/core/providers/cpu/ml/tree_ensemble_common.h:6, from /build/source/onnxruntime/core/providers/cpu/ml/treeregressor.h:5, from /build/source/onnxruntime/core/providers/cpu/ml/treeregressor.cc:4: /build/source/onnxruntime/core/providers/cpu/ml/tree_ensemble_aggregator.h:329:59: error: template-id not allowed for constructor in C++20 [8;;https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/C_002b_002b-Dialect-Options.html#index-Wno-template-id-cdtor-Werror=template-id-cdtor8;;] 329 | TreeAggregatorMax(size_t n_trees, | ^~~~~~ /build/source/onnxruntime/core/providers/cpu/ml/tree_ensemble_aggregator.h:329:59: note: remove the '< >' --- pkgs/development/libraries/onnxruntime/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/development/libraries/onnxruntime/default.nix b/pkgs/development/libraries/onnxruntime/default.nix index a1bfe9dced1d..66d1dd309a68 100644 --- a/pkgs/development/libraries/onnxruntime/default.nix +++ b/pkgs/development/libraries/onnxruntime/default.nix @@ -2,6 +2,7 @@ , stdenv , lib , fetchFromGitHub +, fetchpatch2 , Foundation , abseil-cpp_202401 , cmake @@ -116,6 +117,12 @@ effectiveStdenv.mkDerivation rec { # TODO: Check if it can be dropped after 1.19.0 # https://github.com/microsoft/onnxruntime/commit/b522df0ae477e59f60acbe6c92c8a64eda96cace ./update-re2.patch + # fix `error: template-id not allowed for constructor in C++20` + (fetchpatch2 { + name = "suppress-gcc-warning-in-TreeEnsembleAggregator.patch"; + url = "https://github.com/microsoft/onnxruntime/commit/10883d7997ed4b53f989a49bd4387c5769fbd12f.patch?full_index=1"; + hash = "sha256-NgvuCHE7axaUtZIjtQvDpagr+QtHdyL7xXkPQwZbhvY="; + }) ] ++ lib.optionals cudaSupport [ # We apply the referenced 1064.patch ourselves to our nix dependency. # FIND_PACKAGE_ARGS for CUDA was added in https://github.com/microsoft/onnxruntime/commit/87744e5 so it might be possible to delete this patch after upgrading to 1.17.0