0

I am doing a project with grpc client server. I have added the paths of kaldi source libraries to the CMakeLists.txt file to use them in grpc. Now when I am building the project I am getting errors. Could you please help me solve this issue?

This is how I added the path in the CMakeList.txt:

include_directories("/home/kaldi/src/")

The errors I am getting are:

/usr/bin/ld: CMakeFiles/recognizer_server.dir/recognizer_server.cc.o: in function `kaldi::GetDiagnosticsAndPrintOutput(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, fst::SymbolTable const*, fst::VectorFst<fst::ArcTpl<fst::CompactLatticeWeightTpl<fst::LatticeWeightTpl<float>, int> >, fst::VectorState<fst::ArcTpl<fst::CompactLatticeWeightTpl<fst::LatticeWeightTpl<float>, int> >, std::allocator<fst::ArcTpl<fst::CompactLatticeWeightTpl<fst::LatticeWeightTpl<float>, int> > > > > const&, long*, double*)':
recognizer_server.cc:(.text+0xae): undefined reference to `kaldi::MessageLogger::MessageLogger(kaldi::LogMessageEnvelope::Severity, char const*, char const*, int)'
/usr/bin/ld: recognizer_server.cc:(.text+0x115): undefined reference to `kaldi::CompactLatticeShortestPath(fst::VectorFst<fst::ArcTpl<fst::CompactLatticeWeightTpl<fst::LatticeWeightTpl<float>, int> >, fst::VectorState<fst::ArcTpl<fst::CompactLatticeWeightTpl<fst::LatticeWeightTpl<float>, int> >, std::allocator<fst::ArcTpl<fst::CompactLatticeWeightTpl<fst::LatticeWeightTpl<float>, int> > > > > const&, fst::VectorFst<fst::ArcTpl<fst::CompactLatticeWeightTpl<fst::LatticeWeightTpl<float>, int> >, fst::VectorState<fst::ArcTpl<fst::CompactLatticeWeightTpl<fst::LatticeWeightTpl<float>, int> >, std::allocator<fst::ArcTpl<fst::CompactLatticeWeightTpl<fst::LatticeWeightTpl<float>, int> > > > >*)'
/usr/bin/ld: recognizer_server.cc:(.text+0x265): undefined reference to `kaldi::MessageLogger::MessageLogger(kaldi::LogMessageEnvelope::Severity, char const*, char const*, int)'
/usr/bin/ld: recognizer_server.cc:(.text+0x4ac): undefined reference to `kaldi::MessageLogger::MessageLogger(kaldi::LogMessageEnvelope::Severity, char const*, char const*, int)'
/usr/bin/ld: CMakeFiles/recognizer_server.dir/recognizer_server.cc.o: in function `kaldi::GetVerboseLevel()':
recognizer_server.cc:(.text._ZN5kaldi15GetVerboseLevelEv[_ZN5kaldi15GetVerboseLevelEv]+0xa): undefined reference to `kaldi::g_kaldi_verbose_level'
/usr/bin/ld: CMakeFiles/recognizer_server.dir/recognizer_server.cc.o: in function `kaldi::MessageLogger::Log::operator=(kaldi::MessageLogger const&)':
recognizer_server.cc:(.text._ZN5kaldi13MessageLogger3LogaSERKS0_[_ZN5kaldi13MessageLogger3LogaSERKS0_]+0x1c): undefined reference to `kaldi::MessageLogger::LogMessage() const'
/usr/bin/ld: CMakeFiles/recognizer_server.dir/recognizer_server.cc.o: in function `kaldi::MessageLogger::LogAndThrow::operator=(kaldi::MessageLogger const&)':
recognizer_server.cc:(.text._ZN5kaldi13MessageLogger11LogAndThrowaSERKS0_[_ZN5kaldi13MessageLogger11LogAndThrowaSERKS0_]+0x2e): undefined reference to `kaldi::MessageLogger::LogMessage() const'
/usr/bin/ld: CMakeFiles/recognizer_server.dir/recognizer_server.cc.o: in function `fst::CompatProperties(unsigned long, unsigned long)':
recognizer_server.cc:(.text._ZN3fst16CompatPropertiesEmm[_ZN3fst16CompatPropertiesEmm]+0xf9): undefined reference to `fst::PropertyNames'
/usr/bin/ld: CMakeFiles/recognizer_server.dir/recognizer_server.cc.o: in function `unsigned long fst::TestProperties<fst::ArcTpl<fst::LatticeWeightTpl<float> > >(fst::Fst<fst::ArcTpl<fst::LatticeWeightTpl<float> > > const&, unsigned long, unsigned long*)':
recognizer_server.cc:(.text._ZN3fst14TestPropertiesINS_6ArcTplINS_16LatticeWeightTplIfEEEEEEmRKNS_3FstIT_EEmPm[_ZN3fst14TestPropertiesINS_6ArcTplINS_16LatticeWeightTplIfEEEEEEmRKNS_3FstIT_EEmPm]+0x3f): undefined reference to `FLAGS_fst_verify_properties'
/usr/bin/ld: recognizer_server.cc:(.text._ZN3fst14TestPropertiesINS_6ArcTplINS_16LatticeWeightTplIfEEEEEEmRKNS_3FstIT_EEmPm[_ZN3fst14TestPropertiesINS_6ArcTplINS_16LatticeWeightTplIfEEEEEEmRKNS_3FstIT_EEmPm]+0xce): undefined reference to `FLAGS_fst_error_fatal'
/usr/bin/ld: CMakeFiles/recognizer_server.dir/recognizer_server.cc.o: in function `fst::Fst<fst::ArcTpl<fst::LatticeWeightTpl<float> > >::WriteFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const':
recognizer_server.cc:(.text._ZNK3fst3FstINS_6ArcTplINS_16LatticeWeightTplIfEEEEE9WriteFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNK3fst3FstINS_6ArcTplINS_16LatticeWeightTplIfEEEEE9WriteFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x153): undefined reference to `FLAGS_fst_align'
/usr/bin/ld: recognizer_server.cc:(.text._ZNK3fst3FstINS_6ArcTplINS_16LatticeWeightTplIfEEEEE9WriteFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNK3fst3FstINS_6ArcTplINS_16LatticeWeightTplIfEEEEE9WriteFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x2a5): undefined reference to `FLAGS_fst_align'
/usr/bin/ld: CMakeFiles/recognizer_server.dir/recognizer_server.cc.o: in function `unsigned long fst::TestProperties<fst::ArcTpl<fst::CompactLatticeWeightTpl<fst::LatticeWeightTpl<float>, int> > >(fst::Fst<fst::ArcTpl<fst::CompactLatticeWeightTpl<fst::LatticeWeightTpl<float>, int> > > const&, unsigned long, unsigned long*)':
recognizer_server.cc:(.text._ZN3fst14TestPropertiesINS_6ArcTplINS_23CompactLatticeWeightTplINS_16LatticeWeightTplIfEEiEEEEEEmRKNS_3FstIT_EEmPm[_ZN3fst14TestPropertiesINS_6ArcTplINS_23CompactLatticeWeightTplINS_16LatticeWeightTplIfEEiEEEEEEmRKNS_3FstIT_EEmPm]+0x3f): undefined reference to `FLAGS_fst_verify_properties'
/usr/bin/ld: recognizer_server.cc:(.text._ZN3fst14TestPropertiesINS_6ArcTplINS_23CompactLatticeWeightTplINS_16LatticeWeightTplIfEEiEEEEEEmRKNS_3FstIT_EEmPm[_ZN3fst14TestPropertiesINS_6ArcTplINS_23CompactLatticeWeightTplINS_16LatticeWeightTplIfEEiEEEEEEmRKNS_3FstIT_EEmPm]+0xce): undefined reference to `FLAGS_fst_error_fatal'
/usr/bin/ld: CMakeFiles/recognizer_server.dir/recognizer_server.cc.o: in function `fst::Fst<fst::ArcTpl<fst::CompactLatticeWeightTpl<fst::LatticeWeightTpl<float>, int> > >::WriteFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const':
recognizer_server.cc:(.text._ZNK3fst3FstINS_6ArcTplINS_23CompactLatticeWeightTplINS_16LatticeWeightTplIfEEiEEEEE9WriteFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNK3fst3FstINS_6ArcTplINS_23CompactLatticeWeightTplINS_16LatticeWeightTplIfEEiEEEEE9WriteFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x153): undefined reference to `FLAGS_fst_align'
/usr/bin/ld: recognizer_server.cc:(.text._ZNK3fst3FstINS_6ArcTplINS_23CompactLatticeWeightTplINS_16LatticeWeightTplIfEEiEEEEE9WriteFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNK3fst3FstINS_6ArcTplINS_23CompactLatticeWeightTplINS_16LatticeWeightTplIfEEiEEEEE9WriteFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x2a5): undefined reference to `FLAGS_fst_align'
/usr/bin/ld: CMakeFiles/recognizer_server.dir/recognizer_server.cc.o: in function `fst::internal::FstImpl<fst::ArcTpl<fst::LatticeWeightTpl<float> > >::WriteFstHeader(fst::Fst<fst::ArcTpl<fst::LatticeWeightTpl<float> > > const&, std::ostream&, fst::FstWriteOptions const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, fst::FstHeader*)':
recognizer_server.cc:(.text._ZN3fst8internal7FstImplINS_6ArcTplINS_16LatticeWeightTplIfEEEEE14WriteFstHeaderERKNS_3FstIS5_EERSoRKNS_15FstWriteOptionsEiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPNS_9FstHeaderE[_ZN3fst8internal7FstImplINS_6ArcTplINS_16LatticeWeightTplIfEEEEE14WriteFstHeaderERKNS_3FstIS5_EERSoRKNS_15FstWriteOptionsEiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPNS_9FstHeaderE]+0x11f): undefined reference to `fst::FstHeader::Write(std::ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: CMakeFiles/recognizer_server.dir/recognizer_server.cc.o: in function `fst::internal::FstImpl<fst::ArcTpl<fst::CompactLatticeWeightTpl<fst::LatticeWeightTpl<float>, int> > >::WriteFstHeader(fst::Fst<fst::ArcTpl<fst::CompactLatticeWeightTpl<fst::LatticeWeightTpl<float>, int> > > const&, std::ostream&, fst::FstWriteOptions const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, fst::FstHeader*)':
recognizer_server.cc:(.text._ZN3fst8internal7FstImplINS_6ArcTplINS_23CompactLatticeWeightTplINS_16LatticeWeightTplIfEEiEEEEE14WriteFstHeaderERKNS_3FstIS7_EERSoRKNS_15FstWriteOptionsEiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPNS_9FstHeaderE[_ZN3fst8internal7FstImplINS_6ArcTplINS_23CompactLatticeWeightTplINS_16LatticeWeightTplIfEEiEEEEE14WriteFstHeaderERKNS_3FstIS7_EERSoRKNS_15FstWriteOptionsEiRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmPNS_9FstHeaderE]+0x11f): undefined reference to `fst::FstHeader::Write(std::ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/recognizer_server.dir/build.make:146: recognizer_server] Error 1
make[1]: *** [CMakeFiles/Makefile2:157: CMakeFiles/recognizer_server.dir/all] Error 2
make: *** [Makefile:103: all] Error 2
Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
Prasanna
  • 11
  • 3
  • Aside from adding include directories, you need to **link** with kaldi **libraries**. "Undefined reference" error signals about absent of linking. – Tsyvarev Dec 22 '21 at 07:02
  • Yeah.. I need to link them properly in the CMakeLists. Thank you. I am working on it... – Prasanna Dec 27 '21 at 04:46

0 Answers0