源码交叉编译-嵌入式平台kaldi源码交叉编译

本博文属于系列文章,其他文章参考概述:kaldi嵌入式平台的移植与实现

前言:

编译kaldi源码时,请参考本文在x86平台上进行编译,然后执行以下操作。

Kaldi交叉编译:

1、确保openfst已经编译完成(参见openFst交叉编译),存放路径为:kaldi/tools/openfst/include/kaldi/tools/openfst/lib/

2、确保openBlas和Clapack编译完成,但将Clapack编译生成的lib库(参见物理库OpenBlas和Clapack的交叉编译):libblas.alibclapack.alibf2c.a复制到OpenBLAS/install/lib

3.切换到kaldi/src目录并执行

CXX=mips-linux-gnu-g++AR=mips-linux-gnu-arAS=mips-linux-gnu-asRANLIB=mips-linux-gnu-ranlib./configure --static --use-cuda=no- -openblas-root=/home/xxx/OpenBLAS-master/install --clapack-root=/home/xxx/OpenBLAS-master/install

上面的参数/home/xxx/OpenBLAS-master/install是我的openBlas编译后存放的路径。 安装目录结构如下:

4、执行步骤3的命令后,出现如下信息:

配置 KALDI 以使用 CLAPACK

配置 KALDI 以使用 OPENBLAS

配置...

检查编译器 mips-linux-gnu-g++...

正在检查OpenFst库在/home/chenjian/work/kaldi/tools/openfst...

进行操作系统特定配置...

在 Linux 上:检查线性代数头文件...

你的math库似乎是来自/home/chenjian/OpenBLAS-master/install的OpenBLAS。适当配置。

配置静态 Open Blassince --static-math=yes

已从 /home/chenjian/OpenBLAS-master/install 成功配置 Linux 的 OpenBLAS

信息:配置 KaldinottolinkwithSpeex(不用担心,只有当您

打算使用“compress-uncompress-speex”,这不太可能)

mips-linux-gnu-g++:错误:无法识别的命令行选项“-msse”

mips-linux-gnu-g++:错误:无法识别的命令行选项“-msse2”

make: ***[exp-test]Error1

./configure:第206行:./exp-test:没有这样的文件或目录

成功

编译:makeclean -j;makedepend-j;make -j

...例如-j10,而不是-j,使用指定数量的CPU

更改kaldi.mk文件,修正白色错误源码交叉编译,添加libblas.alibclapack.alibf2c.a的链接库

A。 添加黄色内容

OPENBLASINC=/home/xxx/OpenBLAS-master/install/include

OPENBLASLIBS=/home/xxx/OpenBLAS-master/install/lib/libopenblas.a-lgfortran

OPENBLASLIBS+=/home/xxx/OpenBLAS-master/install/lib/libclapack.a

OPENBLASLIBS+=/home/xxx/OpenBLAS-master/install/lib/libblas.a

OPENBLASLIBS+=/home/xxx/OpenBLAS-master/install/lib/libf2c.a

b. 删除-msse-msse2参数

5、makedepend-j4

6make-j4

如果没有错误,则编译完成。

-------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ------------------

onlinebin解码器交叉编译

默认情况下,kaldi不会编译onlinebin下的解码器,因为onlinebin下的解码器支持在线识别(online-gmm-decode-faster)功能,online-wav-gmm-decode-faster支持音频文件解码结果,如果需要使用音频文件解码,建议使用online2bin下面的解码器,因为online2bin的解码器正在更新,onlinebin的解码器不再更新,编译此解码器的原因:体验在线识别的功效,为之前的 online2binwav 解码改为在线解码作为铺垫。

1.进入onlinebin文件夹并更改Makefile

I) 在Makefile中添加portaudio库(参见音频框架portaudio的交叉编译)

EXTRA_CXXFLAGS+=-Wno-sign-compare-I/home/xxx/portaudio/include

#PA_RingBuffer 接口是内部的,并且不在 .solibray 中导出

#sowehavetolinkagainstthestaticone

ifneq "$(通配符../../tools/portaudio/lib/libportaudio.a)"""

EXTRA_LDLIBS=/home/xxx/portaudio/lib/libportaudio.a

别的

EXTRA_LDLIBS=/home/xxx/portaudio/lib/libportaudio.a

万一

II) 在Makefile中添加Alsa库(参见音频接口Alsa的交叉编译)

UNAME=$(shelluname)

ifeq ($(UNAME),Linux)

ifneq($(通配符../../tools/portaudio/install/include/pa_linux_alsa.h),)

EXTRA_LDLIBS+=/home/xxx/alsa/lib/libasound.so-lrt

别的

EXTRA_LDLIBS+=-lrt

万一

万一

2.进入online目录,修改Makefile源码交叉编译,添加portaudio库

EXTRA_CXXFLAGS+=-Wno-sign-compare-I/home/xxx/portaudio/include

将所有 ../../tools/portaudio/lib/libportaudio.a 更改为 /home/xxx/portaudio/lib/libportaudio.a

3.进入onlinebin目录,执行make

如果没有问题,应该会生成可执行文件online-gmm-decode-faster和online-wav-gmm-decode-faster,通过file可以查看可执行文件的属性,如下:

文件在线 gmm 解码速度更快

online-gmm-decode-faster:ELF32 位LSB 可执行文件、MIPS、MIPS32rel2version1、动态链接、interpreter/lib/ld.so.1、适用于 GNU/Linux2.6.32、剥离

上述kaldi源代码在嵌入式平台上的移植已经完成,并在嵌入式平台上运行相应的解码器。

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悟空资源网 源码编译 源码交叉编译-嵌入式平台kaldi源码交叉编译 https://www.wkzy.net/game/156486.html

常见问题

相关文章

官方客服团队

为您解决烦忧 - 24小时在线 专业服务