为ARM交叉编译Sphinxbase和Pocketsphinx

时间:2018-07-31 10:39:21

标签: arm cross-compiling voice-recognition cmusphinx pocketsphinx

我正在尝试使Pocketsphinx在基于ARM的处理器上工作以进行热字检测。因此,我正在Ubuntu PC上交叉编译Sphinxbase和Pocketsphinx for ARM。我能够在64位Ubuntu PC上安装Sphinxbase和Pocketsphinx,并使用以下命令使热字检测正常工作:

$ ./ pocketsphinx_continuous -inmic yes-关键字“ day” -kws_threshold 20

但是在交叉编译Sphinxbase时出现错误日志。我首先使用以下命令交叉编译Sphinxbase。

$ ./ autogen.sh

$ ./ configure --host = arm-linux-gnueabihf --build = x86_64-linux-gnu --prefix = / home / rakesh / sphinx –without-python

上面命令的日志的某些部分如下:

checking for pthread_create in -lpthread... yes
checking pulse/pulseaudio.h usability... no
checking pulse/pulseaudio.h presence... no
checking for pulse/pulseaudio.h... no
checking alsa/asoundlib.h usability... yes
checking alsa/asoundlib.h presence... yes
checking for alsa/asoundlib.h... yes
checking for snd_pcm_open in -lasound... no
checking for doxygen... no

发出 make 命令时,我收到以下错误日志:

../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_hw_params_any'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_hw_params_sizeof'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_hw_params_set_channels'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_hw_params_set_rate_near'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_nonblock'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_drop'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_close'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_hw_params'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_hw_params_set_period_time_near'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_hw_params_get_buffer_time_max'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_hw_params_set_format'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_start'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_strerror'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_hw_params_set_access'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_open'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_resume'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_readi'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_prepare'
../../src/libsphinxad/.libs/libsphinxad.so: undefined reference to `snd_pcm_hw_params_set_buffer_time_near'
collect2: error: ld returned 1 exit status
Makefile:413: recipe for target 'sphinx_cont_seg' failed
make[2]: *** [sphinx_cont_seg] Error 1
make[2]: Leaving directory '/home/rakesh/Sphinx/sphinxbase/src/sphinx_adtools'
Makefile:374: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/rakesh/Sphinx/sphinxbase/src'
Makefile:479: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

有人可以建议解决错误的方法吗?

1 个答案:

答案 0 :(得分:0)

根据他们位于https://github.com/cmusphinx/pocketsphinx-android-demo的示例Android项目,他们针对Android(例如ARM)的预建Pocketsphinx库与sphinxbase链接在一起,但不包括与访问音频设备有关的方法,例如ad_open,{{1 }},ad_start_rec。换句话说,他们的预建库需要在您选择的音频库的帮助下手动向Pocketsphinx提供音频样本。 在以下位置查看使用哪些源文件来创建此“组合”版本的库: https://github.com/cmusphinx/pocketsphinx-android/blob/master/CMakeLists.txt

在构建sphinxbase时,脚本尝试检测可用的音频库:https://github.com/cmusphinx/sphinxbase/blob/master/configure.ac#L118您应该尝试将其强制为“ none”,并希望它仍然可以编译。