diff --git a/CMakeLists.txt b/CMakeLists.txt index b754f1ea..0857996d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,19 @@ add_library(vosk src/postprocessor.cc ) -find_package(kaldi REQUIRED) +if(BuildForFedora) + # Version used used by Fedora 41 is 1.83 + # TODO: Detect the right version and put it here. + add_definitions(-DOPENFST_VER=18300) + find_package(kaldi REQUIRED) + + # Small Hack for FindKaldi that does not provide the include directory + set(kaldi_INCLUDE_DIRS "${kaldi_DIR}/../../../include") + target_include_directories(vosk PUBLIC ${kaldi_INCLUDE_DIRS} "${kaldi_DIR}/../../../include/kaldi") + + include_directories(/usr/include) +endif() + target_link_libraries(vosk PUBLIC kaldi-base kaldi-online2 kaldi-rnnlm fstngram) include(GNUInstallDirs) diff --git a/README.md b/README.md index 8f4d4d52..c52f4d74 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,18 @@ transcription for lectures and interviews. Vosk scales from small devices like Raspberry Pi or Android smartphone to big clusters. +# Building for Fedora 41 or later + +In order to build it on Fedora 41 using the libraries that are provided by the distro, you need to install kaldi, after building from the source (no kaldi packages for fedora exist). + +then build the package as follows: + +``` +cmake -S ./ -Bbuild/Release -DBuildForFedora=ON -DBUILD_SHARED_LIBS=ON +cmake --build ./build/Release +``` + + # Documentation For installation instructions, examples and documentation visit [Vosk diff --git a/src/recognizer.cc b/src/recognizer.cc index fa3c7909..eceff85a 100644 --- a/src/recognizer.cc +++ b/src/recognizer.cc @@ -855,7 +855,7 @@ const char* Recognizer::PartialResult() clat = decoder_->GetLattice(decoder_->NumFramesInLattice(), false); if (model_->winfo_) { - WordAlignLatticePartial(clat, *model_->trans_model_, *model_->winfo_, 0, &aligned_lat); + WordAlignLattice(clat, *model_->trans_model_, *model_->winfo_, 0, &aligned_lat); } else { CopyLatticeForMbr(clat, &aligned_lat); }