4

我正在尝试编译 PocketSphinxAndroidDemo,它提供了 Android 上 CMU pocketsphinx 语音识别器的示例实现。我首先收到了一个类似于此处讨论的错误。执行 ndk-build 后,我得到了这个错误:

Gdbserver      : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup       : libs/armeabi/gdb.setup
Compile thumb  : pocketsphinx_jni <= pocketsphinx_wrap.c
/home/nick/workspace/android/PocketSphinxDemo/jni/pocketsphinx_wrap.c:761:28: error: sphinxbase/err.h: No such file or directory
/home/nick/workspace/android/PocketSphinxDemo/jni/pocketsphinx_wrap.c: In function 'Java_edu_cmu_pocketsphinx_pocketsphinxJNI_Decoder_1processRaw_1_1SWIG_10':
/home/nick/workspace/android/PocketSphinxDemo/jni/pocketsphinx_wrap.c:1441: warning: assignment discards qualifiers from pointer target type
make: *** [/home/nick/workspace/android/PocketSphinxDemo/obj/local/armeabi/objs-debug/pocketsphinx_jni/pocketsphinx_wrap.o] Error 1

我尝试了重建sphinxbaseandpocketsphinx库和重建 with的建议ndk-build -B,但没有奏效。然后我修改了 jni/pocketsphinx.i swig 文件以更改 err.h 的包含:

#include <pocketsphinx.h>
//#include <sphinxbase/err.h>
#include <err.h>

尝试编译 PocketSphinxAndroidDemo 的人有没有遇到过这个问题?我的编辑似乎让我在编译中走得更远,但现在我遇到了与程序集相关的错误:

Gdbserver      : [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup       : libs/armeabi/gdb.setup
Compile thumb  : pocketsphinx_jni <= pocketsphinx_wrap.c
/home/nick/workspace/android/PocketSphinxDemo/jni/pocketsphinx_wrap.c: In function 'Java_edu_cmu_pocketsphinx_pocketsphinxJNI_Decoder_1processRaw_1_1SWIG_10':
/home/nick/workspace/android/PocketSphinxDemo/jni/pocketsphinx_wrap.c:1442: warning: assignment discards qualifiers from pointer target type
Compile thumb  : sphinxfeat <= cmn.c
/tmp/cceyE035.s: Assembler messages:
/tmp/cceyE035.s:655: Error: selected processor does not support `smull r1,r2,r0,r4'
/tmp/cceyE035.s:657: Error: unshifted register required -- `orr r1,r1,r2,lsl#20'
/tmp/cceyE035.s:932: Error: selected processor does not support `smull r1,r2,r0,r4'
/tmp/cceyE035.s:934: Error: unshifted register required -- `orr r1,r1,r2,lsl#20'
make: *** [/home/nick/workspace/android/PocketSphinxDemo/obj/local/armeabi/objs-debug/sphinxfeat/cmn.o] Error 1

同样,有谁知道如何解决这个问题?我还没有看到任何其他开发人员抱怨这个问题,所以我犹豫要不要走得更远。谢谢你的帮助。

4

2 回答 2

2

显然,一些源代码仍然需要标记为 ARM 编译。我修改了 Android.mk 的以下部分,将 cmn.c 和 lda.c 设置为使用 ARM 编译。

include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(SPHINX_PATH)/sphinxbase/include/android $(SPHINX_PATH)/sphinxbase/include
LOCAL_CFLAGS += -DHAVE_CONFIG_H
LOCAL_CFLAGS += -DANDROID_NDK

LOCAL_PATH := $(SPHINX_PATH)/sphinxbase/src/libsphinxbase/feat
LOCAL_MODULE := sphinxfeat

LOCAL_SRC_FILES := \
    agc.c \
    cmn.c.arm \
    cmn_prior.c.arm \
    feat.c \
    lda.c.arm

我仍然想知道是否有其他人必须这样做才能使他们的代码成功编译。

于 2011-03-03T15:50:06.043 回答
1

编辑文件 jni/Android.mk

更改第 162 行:

LOCAL_STATIC_LIBRARIES := sphinxutil sphinxfe sphinxfeat sphinxlm pocketsphinx

到 :

LOCAL_STATIC_LIBRARIES := pocketsphinx sphinxlm sphinxfeat sphinxfe sphinxutil
于 2012-04-12T13:04:53.927 回答