开发者

Problems trying to build PocketSphinxAndroidDemo using NDK

I am trying to compile PocketSphinxAndroidDemo, which provides an example implementation of the CMU pocketsphinx speech recognizer on Android. I first received an error similar to the discussion here. After executing ndk-build, I got this error:

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/pock开发者_StackOverflow中文版etsphinx_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

I tried the recommendation of rebuilding the sphinxbase and pocketsphinx libraries and rebuilding with ndk-build -B, but that didn't work. I then modified the jni/pocketsphinx.i swig file to change the include for err.h:

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

Did anyone that tried to compile PocketSphinxAndroidDemo ever encounter this problem? My edit seemed to allow me to get further in my compilation, but now I'm getting assembly-related errors:

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

Again, does anyone know how to resolve this problem? I haven't seen any other developers complaining of this problem, so I'm hesitant to go further. Thanks for your help.


Apparently, some of the sources still needed to be marked for ARM compilation. I modified the following section of Android.mk to set cmn.c and lda.c to compile with 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

I am still wondering if anyone else had to do this to get their code to compile successfully.


Edit file jni/Android.mk

Change Line 162 :

LOCAL_STATIC_LIBRARIES := sphinxutil sphinxfe sphinxfeat sphinxlm pocketsphinx

to :

LOCAL_STATIC_LIBRARIES := pocketsphinx sphinxlm sphinxfeat sphinxfe sphinxutil
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜