Menu

Problems with running PocketSphinxAndroidDemo

Help
2011-01-21
2012-09-22
  • Tasbeer Ahsan

    Tasbeer Ahsan - 2011-01-21

    I downloaded the package and tried to run it in Eclipse but got the following
    error

    The import edu.cmu.pocketsphinx.Config cannot be resolved
    The import edu.cmu.pocketsphinx.Decoder cannot be resolved  
    The import edu.cmu.pocketsphinx.Hypothesis cannot be resolved
    The import edu.cmu.pocketsphinx.pocketsphinx cannot be resolved
    

    So I did a bit of research and downloaded the pocketsphinx snapshot and tried
    out swig but got the following error

    tasbeer@tasbeer-desktop:~/Android/pocketsphinx/swig$ make
    mkdir -p edu/cmu/pocketsphinx
    swig -I../include -I../../sphinxbase/include \
                   -java -package edu.cmu.pocketsphinx \
                   -outdir edu/cmu/pocketsphinx pocketsphinx.i
    make: swig: Command not found
    make: *** [pocketsphinx_wrap.c] Error 127
    

    Can anyone please help me out with this ?

    Thanks

     
  • Nickolay V. Shmyrev

    If log says that command not found it usually means you don't have some
    software installed. In this particular case you need to install swig package,
    which you can find in your distribution package manager.

     
  • Anonymous

    Anonymous - 2011-01-29

    Thanks for the reply. I downloaded and installed the swig package and tried to
    run the makefile from the 'swig' folder but it gave the following error.

    tasbeer@tasbeer-desktop:~/Android/pocketsphinx/swig$ make
    cc -g -Wall -DPIC -fPIC -I/usr/lib/jvm/default-java/include `pkg-config
    --cflags sphinxbase pocketsphinx`  -c -o pocketsphinx_wrap.o
    pocketsphinx_wrap.c
    Package sphinxbase was not found in the pkg-config search path.
    Perhaps you should add the directory containing `sphinxbase.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'sphinxbase' found
    Package pocketsphinx was not found in the pkg-config search path.
    Perhaps you should add the directory containing `pocketsphinx.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'pocketsphinx' found
    pocketsphinx_wrap.c:133:17: error: jni.h: No such file or directory
    pocketsphinx_wrap.c:157: error: expected ) before * token
    pocketsphinx_wrap.c:249: error: expected ) before * token
    pocketsphinx_wrap.c:270: error: expected ) before * token
    pocketsphinx_wrap.c:278: error: expected =, ,, ;, asm or
    __attribute__ before SWIG_JavaArrayOutSchar
    pocketsphinx_wrap.c:295: error: expected ) before * token
    pocketsphinx_wrap.c:316: error: expected ) before * token
    pocketsphinx_wrap.c:324: error: expected =, ,, ;, asm or
    __attribute__ before SWIG_JavaArrayOutUchar
    pocketsphinx_wrap.c:341: error: expected ) before * token
    pocketsphinx_wrap.c:362: error: expected ) before * token
    pocketsphinx_wrap.c:370: error: expected =, ,, ;, asm or
    __attribute__ before SWIG_JavaArrayOutShort
    pocketsphinx_wrap.c:387: error: expected ) before * token
    pocketsphinx_wrap.c:408: error: expected ) before * token
    pocketsphinx_wrap.c:416: error: expected =, ,, ;, asm or
    __attribute__ before SWIG_JavaArrayOutUshort
    pocketsphinx_wrap.c:433: error: expected ) before * token
    pocketsphinx_wrap.c:454: error: expected ) before * token
    pocketsphinx_wrap.c:462: error: expected =, ,, ;, asm or
    __attribute__ before SWIG_JavaArrayOutInt
    pocketsphinx_wrap.c:479: error: expected ) before * token
    pocketsphinx_wrap.c:500: error: expected ) before * token
    pocketsphinx_wrap.c:508: error: expected =, ,, ;, asm or
    __attribute__ before SWIG_JavaArrayOutUint
    pocketsphinx_wrap.c:525: error: expected ) before * token
    pocketsphinx_wrap.c:546: error: expected ) before * token
    pocketsphinx_wrap.c:554: error: expected =, ,, ;, asm or
    __attribute__ before SWIG_JavaArrayOutLong
    pocketsphinx_wrap.c:571: error: expected ) before * token
    pocketsphinx_wrap.c:592: error: expected ) before * token
    pocketsphinx_wrap.c:600: error: expected =, ,, ;, asm or
    __attribute__ before SWIG_JavaArrayOutUlong
    pocketsphinx_wrap.c:617: error: expected ) before * token
    pocketsphinx_wrap.c:638: error: expected ) before * token
    pocketsphinx_wrap.c:646: error: expected =, ,, ;, asm or
    __attribute__ before SWIG_JavaArrayOutLonglong
    pocketsphinx_wrap.c:663: error: expected ) before * token
    pocketsphinx_wrap.c:684: error: expected ) before * token
    pocketsphinx_wrap.c:692: error: expected =, ,, ;, asm or
    __attribute__ before SWIG_JavaArrayOutFloat
    pocketsphinx_wrap.c:709: error: expected ) before * token
    pocketsphinx_wrap.c:730: error: expected ) before * token
    pocketsphinx_wrap.c:738: error: expected =, ,, ;, asm or
    __attribute__ before SWIG_JavaArrayOutDouble
    pocketsphinx_wrap.c:757:26: error: pocketsphinx.h: No such file or
    directory
    pocketsphinx_wrap.c:758:28: error: sphinxbase/err.h: No such file or
    directory
    pocketsphinx_wrap.c: In function new_Hypothesis:
    pocketsphinx_wrap.c:777: warning: implicit declaration of function
    ckd_calloc
    pocketsphinx_wrap.c:777: warning: initialization makes pointer from
    integer without a cast
    pocketsphinx_wrap.c:779: warning: implicit declaration of function
    ckd_salloc
    pocketsphinx_wrap.c:779: warning: assignment makes pointer from integer
    without a cast
    pocketsphinx_wrap.c:781: warning: assignment makes pointer from integer
    without a cast
    pocketsphinx_wrap.c: In function delete_Hypothesis:
    pocketsphinx_wrap.c:787: warning: implicit declaration of function
    ckd_free
    pocketsphinx_wrap.c: In function new_Config__SWIG_0:
    pocketsphinx_wrap.c:792: warning: implicit declaration of function
    cmd_ln_init
    pocketsphinx_wrap.c:792: warning: implicit declaration of function
    ps_args
    pocketsphinx_wrap.c:792: error: FALSE undeclared (first use in this
    function)
    pocketsphinx_wrap.c:792: error: (Each undeclared identifier is reported
    only once
    pocketsphinx_wrap.c:792: error: for each function it appears in.)
    pocketsphinx_wrap.c:792: warning: initialization makes pointer from
    integer without a cast
    pocketsphinx_wrap.c: In function new_Config__SWIG_1:
    pocketsphinx_wrap.c:796: warning: implicit declaration of function
    cmd_ln_parse_file_r
    pocketsphinx_wrap.c:796: error: FALSE undeclared (first use in this
    function)
    pocketsphinx_wrap.c:796: warning: initialization makes pointer from
    integer without a cast
    pocketsphinx_wrap.c: In function delete_Config:
    pocketsphinx_wrap.c:800: warning: implicit declaration of function
    cmd_ln_free_r
    pocketsphinx_wrap.c: In function Config_setBoolean:
    pocketsphinx_wrap.c:803: warning: implicit declaration of function
    cmd_ln_set_boolean_r
    pocketsphinx_wrap.c: In function Config_setInt:
    pocketsphinx_wrap.c:806: warning: implicit declaration of function
    cmd_ln_set_int_r
    pocketsphinx_wrap.c: In function Config_setFloat:
    pocketsphinx_wrap.c:809: warning: implicit declaration of function
    cmd_ln_set_float_r
    pocketsphinx_wrap.c: In function Config_setString:
    pocketsphinx_wrap.c:812: warning: implicit declaration of function
    cmd_ln_set_str_r
    pocketsphinx_wrap.c: In function Config_exists:
    pocketsphinx_wrap.c:815: warning: implicit declaration of function
    cmd_ln_exists_r
    pocketsphinx_wrap.c: In function Config_getBoolean:
    pocketsphinx_wrap.c:818: warning: implicit declaration of function
    cmd_ln_boolean_r
    pocketsphinx_wrap.c: In function Config_getInt:
    pocketsphinx_wrap.c:821: warning: implicit declaration of function
    cmd_ln_int_r
    pocketsphinx_wrap.c: In function Config_getFloat:
    pocketsphinx_wrap.c:824: warning: implicit declaration of function
    cmd_ln_float_r
    pocketsphinx_wrap.c: In function Config_getString:
    pocketsphinx_wrap.c:827: warning: implicit declaration of function
    cmd_ln_str_r
    pocketsphinx_wrap.c:827: warning: return makes pointer from integer
    without a cast
    pocketsphinx_wrap.c: In function new_Decoder__SWIG_0:
    pocketsphinx_wrap.c:836: warning: implicit declaration of function
    ps_init
    pocketsphinx_wrap.c:836: error: FALSE undeclared (first use in this
    function)
    pocketsphinx_wrap.c:836: warning: initialization makes pointer from
    integer without a cast
    pocketsphinx_wrap.c: In function new_Decoder__SWIG_1:
    pocketsphinx_wrap.c:840: warning: initialization makes pointer from
    integer without a cast
    pocketsphinx_wrap.c: In function Decoder_getConfig:
    pocketsphinx_wrap.c:844: warning: implicit declaration of function
    cmd_ln_retain
    pocketsphinx_wrap.c:844: warning: implicit declaration of function
    ps_get_config
    pocketsphinx_wrap.c:844: warning: return makes pointer from integer
    without a cast
    pocketsphinx_wrap.c: In function Decoder_startUtt__SWIG_0:
    pocketsphinx_wrap.c:847: warning: implicit declaration of function
    ps_start_utt
    pocketsphinx_wrap.c: In function Decoder_getUttid:
    pocketsphinx_wrap.c:853: warning: implicit declaration of function
    ps_get_uttid
    pocketsphinx_wrap.c:853: warning: return makes pointer from integer
    without a cast
    pocketsphinx_wrap.c: In function Decoder_endUtt:
    pocketsphinx_wrap.c:856: warning: implicit declaration of function
    ps_end_utt
    pocketsphinx_wrap.c: In function Decoder_processRaw__SWIG_0:
    pocketsphinx_wrap.c:859: warning: implicit declaration of function
    ps_process_raw
    pocketsphinx_wrap.c: In function Decoder_getHyp:
    pocketsphinx_wrap.c:866: error: int32 undeclared (first use in this
    function)
    pocketsphinx_wrap.c:866: error: expected ; before best_score
    pocketsphinx_wrap.c:867: warning: implicit declaration of function
    ps_get_hyp
    pocketsphinx_wrap.c:867: error: best_score undeclared (first use in this
    function)
    pocketsphinx_wrap.c:867: warning: assignment makes pointer from integer
    without a cast
    pocketsphinx_wrap.c: In function delete_Decoder:
    pocketsphinx_wrap.c:871: warning: implicit declaration of function
    ps_free
    pocketsphinx_wrap.c: In function setLogfile:
    pocketsphinx_wrap.c:876: warning: implicit declaration of function
    err_set_logfile
    pocketsphinx_wrap.c: At top level:
    pocketsphinx_wrap.c:884: error: expected =, ,, ;, asm or
    __attribute__ before
    Java_edu_cmu_pocketsphinx_pocketsphinxJNI_Hypothesis_1hypstr_1set
    pocketsphinx_wrap.c:910: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:925: error: expected =, ,, ;, asm or
    __attribute__ before
    Java_edu_cmu_pocketsphinx_pocketsphinxJNI_Hypothesis_1uttid_1set
    pocketsphinx_wrap.c:951: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:966: error: expected =, ,, ;, asm or
    __attribute__ before
    Java_edu_cmu_pocketsphinx_pocketsphinxJNI_Hypothesis_1best_1score_1set
    pocketsphinx_wrap.c:979: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:994: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1022: error: expected =, ,, ;, asm or
    __attribute__ before
    Java_edu_cmu_pocketsphinx_pocketsphinxJNI_delete_1Hypothesis
    pocketsphinx_wrap.c:1032: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1044: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1063: error: expected =, ,, ;, asm or
    __attribute__ before
    Java_edu_cmu_pocketsphinx_pocketsphinxJNI_delete_1Config
    pocketsphinx_wrap.c:1073: error: expected =, ,, ;, asm or
    __attribute__ before
    Java_edu_cmu_pocketsphinx_pocketsphinxJNI_Config_1setBoolean
    pocketsphinx_wrap.c:1093: error: expected =, ,, ;, asm or
    __attribute__ before
    Java_edu_cmu_pocketsphinx_pocketsphinxJNI_Config_1setInt
    pocketsphinx_wrap.c:1113: error: expected =, ,, ;, asm or
    __attribute__ before
    Java_edu_cmu_pocketsphinx_pocketsphinxJNI_Config_1setFloat
    pocketsphinx_wrap.c:1133: error: expected =, ,, ;, asm or
    __attribute__ before
    Java_edu_cmu_pocketsphinx_pocketsphinxJNI_Config_1setString
    pocketsphinx_wrap.c:1158: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1180: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1202: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1224: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1246: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1268: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1280: error: expected =, ,, ;, asm or
    __attribute__ before
    Java_edu_cmu_pocketsphinx_pocketsphinxJNI_delete_1SegmentIterator
    pocketsphinx_wrap.c:1290: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1302: error: expected =, ,, ;, asm or
    __attribute__ before
    Java_edu_cmu_pocketsphinx_pocketsphinxJNI_delete_1Lattice
    pocketsphinx_wrap.c:1312: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1324: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1339: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1354: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1369: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1391: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1406: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1421: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1449: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1475: error: expected =, ,, ;, asm or
    __attribute__ before JNICALL
    pocketsphinx_wrap.c:1490: error: expected =, ,, ;, asm or
    __attribute__ before
    Java_edu_cmu_pocketsphinx_pocketsphinxJNI_delete_1Decoder
    pocketsphinx_wrap.c:1500: error: expected =, ,, ;, asm or
    __attribute__ before
    Java_edu_cmu_pocketsphinx_pocketsphinxJNI_setLogfile
    make: *** [pocketsphinx_wrap.o] Error 1
    

    is it because of the PKG_CONFIG_PATH variable or something else ?

     
  • Nickolay V. Shmyrev

    is it because of the PKG_CONFIG_PATH variable

    Yes, it's also missing jni.h

     
  • Anonymous

    Anonymous - 2011-02-21

    Thanks, I finally removed all the errors and warnings and compiled and ran the
    project in Eclipse. However, while I tried to launch the application on the
    emulator it showed a blank screen rather than the activity and stopped
    running. I did some research and found out that a mock sdcard has to be
    created and the files that are given in the RecognizerTask.java file has to be
    uploaded, but where can I get those dictionary files ??

     
  • Nickolay V. Shmyrev

    Hello

    Model files and dictionaries are part of pocketsphinx archive. For example
    pocketsphinx/model/acoustic/hmm/en_US/hub4wsj_sc_8k

     
  • Anonymous

    Anonymous - 2011-03-01

    Hi, I have some similar problems to the ones listed above. I got these errors:

    pocketsphinx_wrap.c:757:26: error: pocketsphinx.h: No such file or directory pocketsphinx_wrap.c:758:28: error: sphinxbase/err.h: No such file or directory
    

    but I managed to resolve them by changing all of the LOCAL_C_INCLUDES to the
    following:

    LOCAL_C_INCLUDES := $(SPHINX_PATH)/pocketsphinx/include $(SPHINX_PATH)/sphinxbase/include
    

    For some reason, I didn't have a $(SPHINX_PATH)/sphinxbase/include/android
    directory. I also had to change the following line in pocketsphinx.i:

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

    Again, for some reason, swig wasn't able to recognize err.h. My latest problem
    is this:

    iconv.h: No such file or directory
    

    I have iconv installed. I tried the following:

    whereis iconv
    iconv: /usr/bin/iconv /usr/include/iconv.h /usr/share/man/man1/iconv.1.gz /usr/share/man/man3/iconv.3.gz
    

    Any ideas what I need to do to link iconf.h properly? I have been using
    Eclipse and the external builders defined in the project. Nobody else that's
    tried to compile PocketSphinxAndroidDemo seems to have had these problems.
    (BTW, I'm not a C/C++ developer)

     
  • Anonymous

    Anonymous - 2011-03-01

    Since I was missing the sphinxbase/include/android folder, I decided to grab
    it from the "bleeding edge" version of the sphinxbase code. I originally
    downloaded the 0.6.1 version, but I've noticed that there are some missing
    folders. Were these supposed to be created by swig somehow?

    Anyway, I fixed my Android.mk file to reference the local C libraries at
    sphinxbase/include/android as well. I no longer have the error about iconf.h.
    Now, I have some errors related to ARM registers:

    selected processor does not support `smull r1,r2,r0,r4' line 655, external location: /tmp/ccMl8dqd.s
    unshifted register required -- `orr r1,r1,r2,lsl#20' line 657, external location: /tmp/ccjVapFt.s
    

    Thanks again for your help.

     
  • Nickolay V. Shmyrev

    Hello

    I suggest you to start a new thread where you can freely discuss your issues
    without hurting others.

    selected processor does not support

    For fast computation sphinxbase uses assembler functions which you can find in
    sphinxbase/include/sphinxbase/fixpoint.h. It seems your processor does not
    support those instructions (btw, that's exactly what you've been told). You
    need to select another target processor or to edit corresponding source code
    in forementioned header.

     
  • Anonymous

    Anonymous - 2011-03-01

    Hi there !

    I did what you said and its up and running this time :D Thanks a lot. I want
    to ask a few other questions which may be unrelated to this thread, but I
    would really appreciate if you could help. I want to build on this project on
    Android and make a speech recognizer for a different language to recognize
    simple commands like Calling a person, searching a contact list etc.. Can you
    please tell me how should I go about (like I can build the language models but
    how can I integrate it to this project) and what are the basic steps that
    should be followed. Thanks a lot again.

    Bikrito

     

Log in to post a comment.