Menu

Static Linking Pocketsphinx OSX XCode

Help
2012-03-11
2012-09-22
  • David Rowland

    David Rowland - 2012-03-11

    Hi there, I have an application running using Pocketsphinx which is fine if
    running on my computer. I discovered that at runtime the app is trying to load
    the dynamic library versions of sphinxbase and pocketsphinx.

    How can I specify the app to use the static .a versions of the libraries
    rather than the dynamic ones? I have the libraries added to my project and am
    using the compiler flag "-static" but I still get:

    Dyld Error Message:
      Library not loaded: /usr/local/lib/libsphinxbase.1.dylib
      Referenced from: <PATH_TO_APP>
      Reason: image not found
    

    displayed on the console when I run on another computer.

    Are there any pre-processor definitions I need to add or additional flags? I'm
    using XCode but linking to the libraries with flags in the build settings.

    Any pointers would be much appreciated, I've spent nearly a day trawling the
    forums and trying things out to no avail.

     
  • Nickolay V. Shmyrev

    Hello

    Pocketsphinx library links statically just fine. In XCode you might want to
    try to point to static libraries (libraries with .a extension) in the command
    line options explicitely instead of using the -static flag. You need to
    provide full build log in order to let us make sure you did everything
    properly.

    You also need to verify you actually trying to run the static binary you have
    just compiled, sometimes people forget to replace the old one.

     
  • David Rowland

    David Rowland - 2012-03-11

    OK thanks a lot. I think I've got it linking correctly to the sphinx libs. I
    just get 3 linker errors related to libiconv now. I presume this isn't a
    system library. How is this normally linked in static builds?

    I searched the forums and someone said you can disable use of it by
    recompiling the sphinx libraries. Is this possible? What implications does
    this have on Sphinx?

    Again, many thanks for the help.

     
  • Nickolay V. Shmyrev

    How is this normally linked in static builds?

    Same is others. You find libiconv.a and include it. As far as I see you need
    to recompile libiconv for that.

    I searched the forums and someone said you can disable use of it by
    recompiling the sphinx libraries. Is this possible?

    Yes

    What implications does this have on Sphinx?

    It will not be able to convert encoding in the language models
    (ngram_model_recode) function

    t

     
  • David Rowland

    David Rowland - 2012-03-15

    Hi again, thanks for all the help. I'd just like to update this thread in case
    any one else comes across the same issue.

    In the end I just recompiled Sphinxbase with "HAVE_ICONV" commented out in
    config.h. It seems to work fine. I had a problem for a while with make
    complaining and giving libtool errors, after updating libtool and coreutils I
    found it was because there was a space in the filepath, bit of a school boy
    error there but noted for future.

    It will not be able to convert encoding in the language models
    (ngram_model_recode) function

    I presume this means if the language models are encoded in something other
    than UTF-8? I'm using ones generated from the online lmtool and they seem to
    work fine.

    Thanks again for all your help, I'm back on track now.

     

Log in to post a comment.