Ubuntu 16.04 上的 Kaldi 工具包安装错误
Kaldi toolkit Installation Error on Ubuntu 16.04
您好,我正在尝试在 Ubuntu 16.04 上安装用于语音识别的 Kaldi 工具包。我已按照安装文件中的说明进行操作。
(1) go to tools/ and follow INSTALL instructions there.
按照工具中 INSTALL 文件中的步骤得到以下输出,
$ extras/check_dependencies.sh
../tools/extras/check_dependencies.sh: all OK.
并执行 make
没有任何错误。如果您想看一看,这是最后几行
$ make
rm -f openfst
ln -s openfst-1.6.1 openfst
Warning: IRSTLM is not installed by default anymore. If you need IRSTLM
Warning: use the script extras/install_irstlm.sh
All done OK.
现在我进入下一步
(2) go to src/ and follow INSTALL instructions there.
在 src 文件夹中,执行 configure
输出如下
$ ./configure
Configuring ...
Backing up kaldi.mk to kaldi.mk.bak ...
Checking compiler g++-4.9 ...
Checking OpenFst library in /home/xxx/Downloads/kaldi/tools/openfst ...
Doing OS specific configurations ...
On Linux: Checking for linear algebra header files ...
Using ATLAS as the linear algebra library.
Successfully configured for Debian/Ubuntu Linux [dynamic libraries] with ATLASLIBS =/usr/lib/libatlas.so.3 /usr/lib/libf77blas.so.3 /usr/lib/libcblas.so.3 /usr/lib/liblapack_atlas.so.3
CUDA will not be used! If you have already installed cuda drivers
and cuda toolkit, try using --cudatk-dir=... option. Note: this is
only relevant for neural net experiments
Info: configuring Kaldi not to link with Speex (don't worry, it's only needed if you
intend to use 'compress-uncompress-speex', which is very unlikely)
SUCCESS
To compile: make clean -j; make depend -j; make -j
... or e.g. -j 10, instead of -j, to use a specified number of CPUs
debug mode enabled...
+ exit 0
$ make depend
也没有任何错误地执行。但是当我执行 make 时,出现以下错误(我没有复制所有内容,因为它很长,如果有人想要我可以 post 完整输出)
$ make
make[2]: Entering directory '/home/srinivas/Downloads/kaldi/src/online2'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/srinivas/Downloads/kaldi/src/online2'
make -C bin
make[2]: Entering directory '/home/srinivas/Downloads/kaldi/src/bin'
g++-4.9 -Wl,-rpath=/home/srinivas/Downloads/kaldi/tools/openfst/lib -rdynamic align-equal.o ../decoder/kaldi-decoder.a ../lat/kaldi-lat.a ../lm/kaldi-lm.a ../fstext/kaldi-fstext.a ../hmm/kaldi-hmm.a ../transform/kaldi-transform.a ../gmm/kaldi-gmm.a ../tree/kaldi-tree.a ../util/kaldi-util.a ../thread/kaldi-thread.a ../matrix/kaldi-matrix.a ../base/kaldi-base.a /home/srinivas/Downloads/kaldi/tools/openfst/lib/libfst.so /usr/lib/libatlas.so.3 /usr/lib/libf77blas.so.3 /usr/lib/libcblas.so.3 /usr/lib/liblapack_atlas.so.3 -lm -lpthread -ldl -o align-equal
align-equal.o: In function `fst::internal::FstImpl<fst::ArcTpl<fst::TropicalWeightTpl<float> > >::WriteFstHeader(fst::Fst<fst::ArcTpl<fst::TropicalWeightTpl<float> > > const&, std::ostream&, fst::FstWriteOptions const&, int, std::string const&, unsigned long, fst::FstHeader*)':
/home/srinivas/Downloads/kaldi/tools/openfst/include/fst/fst.h:745: undefined reference to `fst::FstHeader::Write(std::ostream&, std::string const&) const'
../decoder/kaldi-decoder.a(training-graph-compiler.o): In function `fst::internal::FstImpl<fst::ReverseArc<fst::ArcTpl<fst::TropicalWeightTpl<float> > > >::WriteFstHeader(fst::Fst<fst::ReverseArc<fst::ArcTpl<fst::TropicalWeightTpl<float> > > > const&, std::ostream&, fst::FstWriteOptions const&, int, std::string const&, unsigned long, fst::FstHeader*)':
/home/srinivas/Downloads/kaldi/tools/openfst/include/fst/fst.h:745: undefined reference to `fst::FstHeader::Write(std::ostream&, std::string const&) const'
../decoder/kaldi-decoder.a(training-graph-compiler.o): In function `fst::internal::FstImpl<fst::ArcTpl<fst::LogWeightTpl<float> > >::WriteFstHeader(fst::Fst<fst::ArcTpl<fst::LogWeightTpl<float> > > const&, std::ostream&, fst::FstWriteOptions const&, int, std::string const&, unsigned long, fst::FstHeader*)':
/home/srinivas/Downloads/kaldi/tools/openfst/include/fst/fst.h:745: undefined reference to `fst::FstHeader::Write(std::ostream&, std::string const&) const'
../fstext/kaldi-fstext.a(kaldi-fst-io.o): In function `fst::ReadFstKaldi(std::string)':
/home/srinivas/Downloads/kaldi/src/fstext/kaldi-fst-io.cc:34: undefined reference to `fst::FstHeader::Read(std::istream&, std::string const&, bool)'
/home/srinivas/Downloads/kaldi/src/fstext/kaldi-fst-io.cc:37: undefined reference to `fst::FstReadOptions::FstReadOptions(std::string const&, fst::FstHeader const*, fst::SymbolTable const*, fst::SymbolTable const*)'
../fstext/kaldi-fstext.a(kaldi-fst-io.o): In function `fst::internal::FstImpl<fst::ArcTpl<fst::TropicalWeightTpl<float> > >::ReadHeader(std::istream&, fst::FstReadOptions const&, int, fst::FstHeader*)':
/home/srinivas/Downloads/kaldi/tools/openfst/include/fst/fst.h:796: undefined reference to `fst::FstHeader::Read(std::istream&, std::string const&, bool)'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'align-equal' failed
make[2]: *** [align-equal] Error 1
make[2]: Leaving directory '/home/srinivas/Downloads/kaldi/src/bin'
Makefile:142: recipe for target 'bin' failed
make[1]: *** [bin] Error 2
make[1]: Leaving directory '/home/srinivas/Downloads/kaldi/src'
Makefile:35: recipe for target 'all' failed
make: *** [all] Error 2
我什至手动搜索了图书馆,它们就在这个位置../tools/openfst。我什至尝试在系统范围内安装 openfst,但没有任何效果。任何帮助将不胜感激。谢谢!
斯里尼瓦斯
我也在使用 ubuntu 16.04 LTS,我建议您查看此网站并按照步骤进行操作。我想它会解决你的问题。
http://jrmeyer.github.io/kaldi/2016/01/26/Installing-Kaldi.html
我用g++-5解决了。 Ubuntu 16.04 默认使用 g++-5 作为预安装包,当我尝试使用 g++-4.9 和 link 编译 Kaldi 时 Ubuntu 使用 g++-5 的包,linker 导致未定义的引用。我也遇到了与其他图书馆类似的问题
为了解决任何此类错误,我一直遵循以下步骤:
- 使用g++-4.8编译kaldi源码
- 将共享标志添加到您的配置命令中 例如CXX=g++-4.8 ./configure --shared
- 在 src 目录中制作之前也制作依赖项 例如sudo make depend CXX=g++-4.8
- 在制作时使用 root 权限,并在您的命令中添加 g++-4.8 指令,例如sudo make CXX=g++-4.8
- 之后使用 sudo make ext CXX=g++-4.8
编译在线扩展
希望这能解决您的问题。
你确实可以用g++-5来编译kaldi。它将不支持 cuda,因为 ubuntu 16.04 附带 cuda 7.5,它与 gcc 5 不兼容。
在 ubuntu 16.04 的 CUDA 支持下构建:
sudo apt-get install nvidia-cuda-dev nvidia-cuda-toolkit libcupti-dev g++-4.8
cd tools; make CXX=g++-4.8
cd src; CXX=g++-4.8 ./configure --shared && make-j8
您好,我正在尝试在 Ubuntu 16.04 上安装用于语音识别的 Kaldi 工具包。我已按照安装文件中的说明进行操作。
(1) go to tools/ and follow INSTALL instructions there.
按照工具中 INSTALL 文件中的步骤得到以下输出,
$ extras/check_dependencies.sh
../tools/extras/check_dependencies.sh: all OK.
并执行 make
没有任何错误。如果您想看一看,这是最后几行
$ make
rm -f openfst
ln -s openfst-1.6.1 openfst
Warning: IRSTLM is not installed by default anymore. If you need IRSTLM
Warning: use the script extras/install_irstlm.sh
All done OK.
现在我进入下一步
(2) go to src/ and follow INSTALL instructions there.
在 src 文件夹中,执行 configure
输出如下
$ ./configure
Configuring ...
Backing up kaldi.mk to kaldi.mk.bak ...
Checking compiler g++-4.9 ...
Checking OpenFst library in /home/xxx/Downloads/kaldi/tools/openfst ...
Doing OS specific configurations ...
On Linux: Checking for linear algebra header files ...
Using ATLAS as the linear algebra library.
Successfully configured for Debian/Ubuntu Linux [dynamic libraries] with ATLASLIBS =/usr/lib/libatlas.so.3 /usr/lib/libf77blas.so.3 /usr/lib/libcblas.so.3 /usr/lib/liblapack_atlas.so.3
CUDA will not be used! If you have already installed cuda drivers
and cuda toolkit, try using --cudatk-dir=... option. Note: this is
only relevant for neural net experiments
Info: configuring Kaldi not to link with Speex (don't worry, it's only needed if you
intend to use 'compress-uncompress-speex', which is very unlikely)
SUCCESS
To compile: make clean -j; make depend -j; make -j
... or e.g. -j 10, instead of -j, to use a specified number of CPUs
debug mode enabled...
+ exit 0
$ make depend
也没有任何错误地执行。但是当我执行 make 时,出现以下错误(我没有复制所有内容,因为它很长,如果有人想要我可以 post 完整输出)
$ make
make[2]: Entering directory '/home/srinivas/Downloads/kaldi/src/online2'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/srinivas/Downloads/kaldi/src/online2'
make -C bin
make[2]: Entering directory '/home/srinivas/Downloads/kaldi/src/bin'
g++-4.9 -Wl,-rpath=/home/srinivas/Downloads/kaldi/tools/openfst/lib -rdynamic align-equal.o ../decoder/kaldi-decoder.a ../lat/kaldi-lat.a ../lm/kaldi-lm.a ../fstext/kaldi-fstext.a ../hmm/kaldi-hmm.a ../transform/kaldi-transform.a ../gmm/kaldi-gmm.a ../tree/kaldi-tree.a ../util/kaldi-util.a ../thread/kaldi-thread.a ../matrix/kaldi-matrix.a ../base/kaldi-base.a /home/srinivas/Downloads/kaldi/tools/openfst/lib/libfst.so /usr/lib/libatlas.so.3 /usr/lib/libf77blas.so.3 /usr/lib/libcblas.so.3 /usr/lib/liblapack_atlas.so.3 -lm -lpthread -ldl -o align-equal
align-equal.o: In function `fst::internal::FstImpl<fst::ArcTpl<fst::TropicalWeightTpl<float> > >::WriteFstHeader(fst::Fst<fst::ArcTpl<fst::TropicalWeightTpl<float> > > const&, std::ostream&, fst::FstWriteOptions const&, int, std::string const&, unsigned long, fst::FstHeader*)':
/home/srinivas/Downloads/kaldi/tools/openfst/include/fst/fst.h:745: undefined reference to `fst::FstHeader::Write(std::ostream&, std::string const&) const'
../decoder/kaldi-decoder.a(training-graph-compiler.o): In function `fst::internal::FstImpl<fst::ReverseArc<fst::ArcTpl<fst::TropicalWeightTpl<float> > > >::WriteFstHeader(fst::Fst<fst::ReverseArc<fst::ArcTpl<fst::TropicalWeightTpl<float> > > > const&, std::ostream&, fst::FstWriteOptions const&, int, std::string const&, unsigned long, fst::FstHeader*)':
/home/srinivas/Downloads/kaldi/tools/openfst/include/fst/fst.h:745: undefined reference to `fst::FstHeader::Write(std::ostream&, std::string const&) const'
../decoder/kaldi-decoder.a(training-graph-compiler.o): In function `fst::internal::FstImpl<fst::ArcTpl<fst::LogWeightTpl<float> > >::WriteFstHeader(fst::Fst<fst::ArcTpl<fst::LogWeightTpl<float> > > const&, std::ostream&, fst::FstWriteOptions const&, int, std::string const&, unsigned long, fst::FstHeader*)':
/home/srinivas/Downloads/kaldi/tools/openfst/include/fst/fst.h:745: undefined reference to `fst::FstHeader::Write(std::ostream&, std::string const&) const'
../fstext/kaldi-fstext.a(kaldi-fst-io.o): In function `fst::ReadFstKaldi(std::string)':
/home/srinivas/Downloads/kaldi/src/fstext/kaldi-fst-io.cc:34: undefined reference to `fst::FstHeader::Read(std::istream&, std::string const&, bool)'
/home/srinivas/Downloads/kaldi/src/fstext/kaldi-fst-io.cc:37: undefined reference to `fst::FstReadOptions::FstReadOptions(std::string const&, fst::FstHeader const*, fst::SymbolTable const*, fst::SymbolTable const*)'
../fstext/kaldi-fstext.a(kaldi-fst-io.o): In function `fst::internal::FstImpl<fst::ArcTpl<fst::TropicalWeightTpl<float> > >::ReadHeader(std::istream&, fst::FstReadOptions const&, int, fst::FstHeader*)':
/home/srinivas/Downloads/kaldi/tools/openfst/include/fst/fst.h:796: undefined reference to `fst::FstHeader::Read(std::istream&, std::string const&, bool)'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'align-equal' failed
make[2]: *** [align-equal] Error 1
make[2]: Leaving directory '/home/srinivas/Downloads/kaldi/src/bin'
Makefile:142: recipe for target 'bin' failed
make[1]: *** [bin] Error 2
make[1]: Leaving directory '/home/srinivas/Downloads/kaldi/src'
Makefile:35: recipe for target 'all' failed
make: *** [all] Error 2
我什至手动搜索了图书馆,它们就在这个位置../tools/openfst。我什至尝试在系统范围内安装 openfst,但没有任何效果。任何帮助将不胜感激。谢谢!
斯里尼瓦斯
我也在使用 ubuntu 16.04 LTS,我建议您查看此网站并按照步骤进行操作。我想它会解决你的问题。
http://jrmeyer.github.io/kaldi/2016/01/26/Installing-Kaldi.html
我用g++-5解决了。 Ubuntu 16.04 默认使用 g++-5 作为预安装包,当我尝试使用 g++-4.9 和 link 编译 Kaldi 时 Ubuntu 使用 g++-5 的包,linker 导致未定义的引用。我也遇到了与其他图书馆类似的问题
为了解决任何此类错误,我一直遵循以下步骤:
- 使用g++-4.8编译kaldi源码
- 将共享标志添加到您的配置命令中 例如CXX=g++-4.8 ./configure --shared
- 在 src 目录中制作之前也制作依赖项 例如sudo make depend CXX=g++-4.8
- 在制作时使用 root 权限,并在您的命令中添加 g++-4.8 指令,例如sudo make CXX=g++-4.8
- 之后使用 sudo make ext CXX=g++-4.8 编译在线扩展
希望这能解决您的问题。
你确实可以用g++-5来编译kaldi。它将不支持 cuda,因为 ubuntu 16.04 附带 cuda 7.5,它与 gcc 5 不兼容。
在 ubuntu 16.04 的 CUDA 支持下构建:
sudo apt-get install nvidia-cuda-dev nvidia-cuda-toolkit libcupti-dev g++-4.8
cd tools; make CXX=g++-4.8
cd src; CXX=g++-4.8 ./configure --shared && make-j8