From 4d4563b9d8c685407b56e1d472c7104a5d8a9b6a Mon Sep 17 00:00:00 2001 From: matthiasdotsh Date: Fri, 2 Jan 2026 13:19:47 +0100 Subject: [PATCH] kaldi: add openfst patch for building with gcc15 --- .../ka/kaldi/fix-gcc15-copy-constructor.patch | 42 +++++++++++++++++++ pkgs/by-name/ka/kaldi/package.nix | 11 +++-- 2 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 pkgs/by-name/ka/kaldi/fix-gcc15-copy-constructor.patch diff --git a/pkgs/by-name/ka/kaldi/fix-gcc15-copy-constructor.patch b/pkgs/by-name/ka/kaldi/fix-gcc15-copy-constructor.patch new file mode 100644 index 000000000000..339a38ca0901 --- /dev/null +++ b/pkgs/by-name/ka/kaldi/fix-gcc15-copy-constructor.patch @@ -0,0 +1,42 @@ +From fece8a6f239c7323c61238dfdd1e0dd47885fc88 Mon Sep 17 00:00:00 2001 +From: matthiasdotsh +Date: Fri, 2 Jan 2026 11:08:17 +0100 +Subject: [PATCH] Fix copy constructor member access in VectorHashBiTable + +The copy constructor of VectorHashBiTable was incorrectly accessing +`table.s_` instead of `table.selector_`, causing a compilation error +with stricter C++ compilers. + +This issue manifests with GCC 15, which enforces more rigorous checks +on template member access. The compiler error was: + + error: 'const class fst::VectorHashBiTable<...>' has no member + named 's_'; did you mean 'h_'? + +The member variable is actually named `selector_`, not `s_`. This fix +aligns the copy constructor with the correct member variable name used +throughout the class definition. + +Fixes build failures on systems with GCC 15. + +Related: https://github.com/gpustack/gpustack/issues/1798#issuecomment-2980869111 +--- + src/include/fst/bi-table.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/include/fst/bi-table.h b/src/include/fst/bi-table.h +index 9651cfe..fb747fe 100644 +--- a/src/include/fst/bi-table.h ++++ b/src/include/fst/bi-table.h +@@ -317,7 +317,7 @@ class VectorHashBiTable { + } + + VectorHashBiTable(const VectorHashBiTable &table) +- : selector_(new S(table.s_)), fp_(new FP(*table.fp_)), ++ : selector_(new S(table.selector_)), fp_(new FP(*table.fp_)), + h_(new H(*table.h_)), id2entry_(table.id2entry_), + fp2id_(table.fp2id_), hash_func_(*this), hash_equal_(*this), + keys_(table.keys_.size(), hash_func_, hash_equal_) { +-- +2.52.0 + diff --git a/pkgs/by-name/ka/kaldi/package.nix b/pkgs/by-name/ka/kaldi/package.nix index 5703c366f9ff..f9684beb108f 100644 --- a/pkgs/by-name/ka/kaldi/package.nix +++ b/pkgs/by-name/ka/kaldi/package.nix @@ -73,9 +73,14 @@ stdenv.mkDerivation (finalAttrs: { owner = "kkm000"; repo = "openfst"; rev = "338225416178ac36b8002d70387f5556e44c8d05"; - hash = "sha256-y1E6bQgBfYt1Co02UutOyEM2FnETuUl144tHwypiX+M="; - # https://github.com/kkm000/openfst/issues/59 - postFetch = ''(cd "$out"; patch -p1 < '${./gcc14.patch}')''; + hash = "sha256-9xsL78mkR40zkoRYWsH+iaPa5MYc4BzwslzxGKv4j4I="; + postFetch = '' + cd "$out" + # https://github.com/kkm000/openfst/issues/59 + patch -p1 < ${./gcc14.patch} + # Patch for compiling openfst with gcc >= 15 + patch -p1 < ${./fix-gcc15-copy-constructor.patch} + ''; }; };