开发者

Issue trying to build PocketSphinx for Android using the NDK on Windows with Cygwin

开发者 https://www.devze.com 2023-01-31 11:08 出处:网络
I\'m currently trying to build the PocketSphinx library for Android using the NDK on Windows with Cygwin. I have the PocketSphinxAndroidDemo project code. I also have the pocketsphinx and shpinxbase p

I'm currently trying to build the PocketSphinx library for Android using the NDK on Windows with Cygwin. I have the PocketSphinxAndroidDemo project code. I also have the pocketsphinx and shpinxbase projects as sub folders of the E:/Development/CMUSphinx folder.

I'm trying to build using ndk-build from the project folder. The Android.mk file in the /jni/ folder of the project looks like this -

# Build the native component of the PocketSphinx library for Android.

# You MUST change this to the absolute path of the directory containing
# sphinxbase and pocketsphinx source code.
SPHINX_PATH := E:/Development/CMUSphinx

# Copy this Android.mk along with pocketsphinx_wrap.c and the contents of the 'edu' folder
# built by swig to the jni/ directory of your Android project.
BASE_PATH := $(call my-dir)

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/util
LOCAL_MODULE := sphinxutil

LOCAL_SRC_FILES := \
 bio.c \
 bitvec.c \
 case.c \
 ckd_alloc.c \
 cmd_ln.c \
 dtoa.c \
 err.c \
 errno.c \
 f2c_lite.c \
 filename.c \
 genrand.c \
 glist.c \
 hash_table.c \
 heap.c \
 huff_code.c \
 info.c \
 listelem_alloc.c \
 logmath.c.arm \
 matrix.c \
 mmio.c \
 pio.c \
 profile.c \
 sbthread.c \
 strfuncs.c \
 utf8.c

include $(BUILD_STATIC_LIBRARY)

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/fe
LOCAL_MODULE := sphinxfe
LOCAL_ARM_MODE := arm

LOCAL_SRC_FILES := \
 fe_interface.c \
 fe_sigproc.c \
 fe_warp_affine.c \
 fe_warp.c \
 fe_warp_inverse_linear.c \
 fe_warp_piecewise_linear.c \
 fixlog.c

include $(BUILD_STATIC_LIBRARY)

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 \
 cmn_prior.c \
 feat.c \
 lda.c

include $(BUILD_STATIC_LIBRARY)

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/lm
LOCAL_MODULE := sphinxlm

LOCAL_SRC_FILES := \
 fsg_model.c \
 jsgf.c \
 jsgf_parser.c \
 jsgf_scanner开发者_开发技巧.c \
 lm3g_model.c \
 ngram_model_arpa.c \
 ngram_model_dmp.c \
 ngram_model_set.c \
 ngram_model.c

include $(BUILD_STATIC_LIBRARY)

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

LOCAL_PATH := $(SPHINX_PATH)/pocketsphinx/src/libpocketsphinx
LOCAL_MODULE := pocketsphinx

LOCAL_SRC_FILES := \
 acmod.c     \
 bin_mdef.c    \
 blkarray_list.c   \
 dict.c     \
 dict2pid.c    \
 fsg_history.c   \
 fsg_lextree.c   \
 fsg_search.c   \
 hmm.c.arm     \
 mdef.c     \
 ms_gauden.c.arm    \
 ms_mgau.c.arm    \
 ms_senone.c.arm    \
 ngram_search.c   \
 ngram_search_fwdtree.c \
 ngram_search_fwdflat.c \
 phone_loop_search.c  \
 pocketsphinx.c \
 ps_lattice.c   \
 ps_mllr.c    \
 ptm_mgau.c.arm    \
 s2_semi_mgau.c.arm   \
 tmat.c     \
 vector.c

include $(BUILD_STATIC_LIBRARY)

# Create the dynamic library wrapper
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(SPHINX_PATH)/sphinxbase/include/android $(SPHINX_PATH)/sphinxbase/include \
     $(SPHINX_PATH)/pocketsphinx/include
LOCAL_CFLAGS += -DHAVE_CONFIG_H
LOCAL_CFLAGS += -DANDROID_NDK

LOCAL_PATH := $(BASE_PATH)
LOCAL_MODULE := pocketsphinx_jni

LOCAL_SRC_FILES := pocketsphinx_wrap.c

PRIVATE_WHOLE_STATIC_LIBRARIES := \
 $(call static-library-path,sphinxutil) \
 $(call static-library-path,sphinxfe) \
 $(call static-library-path,sphinxfeat) \
 $(call static-library-path,sphinxlm) \
 $(call static-library-path,pocketsphinx)
LOCAL_STATIC_LIBRARIES := sphinxutil sphinxfe sphinxfeat sphinxlm pocketsphinx

include $(BUILD_SHARED_LIBRARY)

When I run the ndk-build command I get the following error:

build-binary.mk:197: *** target pattern contains no '%'. Stop.

I can build all the ndk samples just fine. Any clue what's causing this error? Many thanks in advance!


Jason, Edit jni/Android.mk file

Change Line 162 :

LOCAL_STATIC_LIBRARIES := sphinxutil sphinxfe sphinxfeat sphinxlm pocketsphinx

to :

LOCAL_STATIC_LIBRARIES := pocketsphinx sphinxlm sphinxfeat sphinxfe sphinxutil

That will resolve your issue.


Do you know if this project has been previously built using cygwin with success? Cygwin has a number of oddities, from the awkward combination of windows drive letters with unix paths, to interpreting an inadvertent double slash in an assembled path unusually, and more. You could try the /cygdrive/e/ type of path instead of a drive letter, but who knows if that will help.


Jason, you have to change your sphinx path to cygwin format i.e without ":"
change

SPHINX_PATH := E:/Development/CMUSphinx

to

SPHINX_PATH := /cygdrive/e/Development/CMUSphinx

this will fix the error


I used following link for Building Pocketsphinx On Android On Windows https://sites.google.com/site/opiatefuchs/home/pocketsphinxandroiddemo but it misses one step that @Hitesh mentioned about replacing LOCAL_STATIC_LIBRARIES in jni/Android.mk file and I was able to build to latest 0.8 version.. thanks @Hitesh

0

精彩评论

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