Menu

Pocketsphinx and Android NDK

Help
z
2010-10-27
2012-09-22
  • z

    z - 2010-10-27

    Has anyone had any luck installing pocketsphinx on Android via the NDK? I've
    found the Android project at http://cmusphinx.svn.sourceforge.net/viewvc/cmus
    phinx/trunk/PocketSphinxAndroidDemo/,
    but the project doesn't have
    access to any cmu classes, and I don't think the NDK is in there.

    I was able to generate libpocketsphinx_jni.so via swig, and I'm trying to run
    ndk-build in the sample project root to create the Java bindings for
    pocketsphinx.

    When I run ndk-build, I get this error:

    Gdbserver      : [arm-eabi-4.4.0] /home/zach/Android/PocketSphinx/libs/armeabi/gdbserver
    Gdbsetup       : /home/zach/Android/PocketSphinx/libs/armeabi/gdb.setup
    Gdbsetup       : + source directory /home/zach/Android/PocketSphinx/jni
    Gdbsetup       : + source directory /home/zach/Android/PocketSphinx/jni
    Gdbsetup       : + source directory /home/zach/Android/PocketSphinx/jni
    Gdbsetup       : + source directory /home/zach/Android/PocketSphinx/jni
    Gdbsetup       : + source directory /home/zach/Android/PocketSphinx/jni
    Gdbsetup       : + source directory /home/zach/Android/PocketSphinx/jni
    Compile thumb  : pocketsphinx_jni <= /home/zach/Android/PocketSphinx/jni/pocketsphinx_wrap.c
    /home/zach/Android/PocketSphinx/jni/pocketsphinx_wrap.c:761:28: error: sphinxbase/err.h: No such file or directory
    /home/zach/Android/PocketSphinx/jni/pocketsphinx_wrap.c: In function 'Java_edu_cmu_pocketsphinx_pocketsphinxJNI_Decoder_1processRaw_1_1SWIG_10':
    /home/zach/Android/PocketSphinx/jni/pocketsphinx_wrap.c:1438: warning: assignment discards qualifiers from pointer target type
    make: *** [/home/zach/Android/PocketSphinx/obj/local/armeabi/objs/pocketsphinx_jni/pocketsphinx_wrap.o] Error 1
    

    Could someone please help me get this test project up and running? I can't
    find any documentation on it anywhere, and I would be happy to post a wiki
    page explaining how to install pocketsphinx on Android once someone explains
    what's going on.

    Thanks,
    Zach

     
  • Nickolay V. Shmyrev

    I can't find any documentation on it anywhere, and I would be happy to post
    a wiki page explaining how to install pocketsphinx on Android once someone
    explains what's going on.

    Hello Zach

    Sorry, this is very experimental and new feature, so not much docs out there.
    Any help would be welcome.

    /home/zach/Android/PocketSphinx/jni/pocketsphinx_wrap.c:761:28: error:
    sphinxbase/err.h:

    That's because path is not set properly. See in Makefile:

    # You MUST change this to the absolute path of the directory containing
    # sphinxbase and pocketsphinx source code.
    SPHINX_PATH := $(HOME)/Projects/Sphinx/trunk
    

    Also, the layout of sources must be fixed. Same folder should contain both
    sphinxbase, pocketsphinx and demo without versions in folder name.

     
  • z

    z - 2010-10-27

    When I encountered this error, I had set my SPHINX_PATH to a directory
    containing pocketsphinx and sphinxbase. I noticed that sphinxbase/err.h is
    present in /usr/include. Is there anything I should add to the SPHINX_PATH?

    Thanks,
    Zach

     
  • Nickolay V. Shmyrev

    SPHINX_ROOT should point to root folder with subfolder like pocketsphinx,
    sphinxbase, demo. If you have latest sphinxbase, there must be a file
    sphinxbase/include/sphinxbase/err.h

     
  • z

    z - 2010-10-27

    I have a sphinxbase/include/err.h, but not a
    sphinxbase/include/sphinxbase/err.h. The only directories I have in
    sphinxbase/include are s60, win32, and wince. I downloaded Sphinxbase 0.6.1
    from the downloads page. Should I check the head revision out from SVN?

     
  • Nickolay V. Shmyrev

    Should I check the head revision out from SVN?

    yes

     
  • z

    z - 2010-10-27

    Ok, thanks. And where does the demo directory come from?

     
  • z

    z - 2010-10-27

    If I ignore the demo directory, I was able to successfully create an .so file.
    However, when I try to run the application, I encounter the following error:

    Do you know what could we wrong with the builder? Has anyone ever gotten past
    this issue in the past?

     
  • Nickolay V. Shmyrev

    According to properties, the project must be named PocketSphinxDemo and
    builder has appropriate location configured:

    attribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/PocketSphinxDemo/jni}"/>
    

    I think you just need to rename the project and builder will work smoothly.
    Otherwise it's always easy to find the issue.

     
  • z

    z - 2010-10-27

    Thanks, Nickolay. This may be a dumb question, but where did that property
    snippet come from? I tried using Eclipse's refactoring tools to rename the
    project to PocketSphinxDemo, but I'm still getting the same errors.

    Thanks,
    Zach

     
  • Nickolay V. Shmyrev

    There is hidden folder PocketSphinxAndroidDemo/.externalToolBuilders

    with files

    NDK build.launch SWIG.launch

    They must be set in launcher properly. Probably you want to start with clean
    checkout. In any case you can just disable builder.

     
  • z

    z - 2010-10-27

    Which builders are mandatory? I tried disabling SWIG and NDK Build and that
    reduced the number of errors, but I still have some.

     
  • Nickolay V. Shmyrev

    Well, they are not mandatory if you can do same actions from console. I think
    they will work though, probably you need to adjust few other filenames in
    order to make it work.

     
  • z

    z - 2010-10-27

    Gotcha, thanks. We're finally getting somewhere! I was able to run the
    application, but now I'm running into a runtime error. Here's the Logcat
    output:

    10-27 17:18:51.999: INFO/ActivityManager(1209): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=edu.cmu.pocketsphinx.demo/.PocketSphinxDemo }
    10-27 17:18:52.061: INFO/ActivityManager(1209): Start proc edu.cmu.pocketsphinx.demo for activity edu.cmu.pocketsphinx.demo/.PocketSphinxDemo: pid=24631 uid=10129 gids={1015}
    10-27 17:18:52.241: DEBUG/vending(24616): [10] LocalAssetCache.updateOnePackage(): No local info for edu.cmu.pocketsphinx.demo
    10-27 17:18:52.342: DEBUG/dalvikvm(24631): Trying to load lib /data/data/edu.cmu.pocketsphinx.demo/lib/libpocketsphinx_jni.so 0x459afe48
    10-27 17:18:52.342: DEBUG/dalvikvm(24631): Added shared lib /data/data/edu.cmu.pocketsphinx.demo/lib/libpocketsphinx_jni.so 0x459afe48
    10-27 17:18:52.342: DEBUG/dalvikvm(24631): No JNI_OnLoad found in /data/data/edu.cmu.pocketsphinx.demo/lib/libpocketsphinx_jni.so 0x459afe48, skipping init
    10-27 17:18:53.913: INFO/ActivityManager(1209): Process edu.cmu.pocketsphinx.demo (pid 24631) has died.
    

    Do you know what JNI_OnLoad should be doing, and why can't it be found?

    Thanks,
    Zach

     
  • Nickolay V. Shmyrev

    Do you know what JNI_OnLoad should be doing, and why can't it be found?

    I think you should better ask this quesiton on android developers group. Or
    search in google, there seems to be many hits on this issue.

     
  • z

    z - 2010-10-28

    Thanks, I'll try that.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.