cmusphinx / node-pocketsphinx

Pocketsphinx bindings for Node.JS
Other
242 stars 47 forks source link

Error: libpocketsphinx.so.3: cannot open shared object file: No such file or directory #15

Closed swestrich closed 8 years ago

swestrich commented 8 years ago

I just don't understand why I am getting this error.

When I try to load node-pocketshinx I get the above error on this line:

var PocketSphinx = require('./build/Release/PocketSphinx.node');

This is my LD path

:/usr/local/lib $ echo $LD_LIBRARY_PATH
/usr/local/lib:~/.c9/local/lib

And here is what it contains.

:/usr/local/lib $ ls
libpocketsphinx.a    libpocketsphinx.so.3@      libsphinxad.la*    libsphinxad.so.3.0.0*   libsphinxbase.so@        pkgconfig/  site_ruby/
libpocketsphinx.la*  libpocketsphinx.so.3.0.0*  libsphinxad.so@    libsphinxbase.a        libsphinxbase.so.3@      python2.7/
libpocketsphinx.so@  libsphinxad.a              libsphinxad.so.3@  libsphinxbase.la*      libsphinxbase.so.3.0.0*  python3.4/

Not sure if this is an issue or me just being stupid but I've spent quite a while trying everything I could think of already.

nshmyrev commented 8 years ago

You can use 'ldd' binary to debug dynamic library loading. Most likely you do not export LD_LIBRARY_PATH properly.

swestrich commented 8 years ago

I'm confused, my LD_LIBRARY_PATH looks fine when I echo it, how could I not be exporting it properly?

In pocketsphinx.target.mk I have this:

# This file is generated by gyp; do not edit.

TOOLSET := target
TARGET := PocketSphinx
### Rules for action "swig_ps":
quiet_cmd_binding_gyp_PocketSphinx_target_swig_ps = ACTION Creating pocketsphinx wrapper $@
cmd_binding_gyp_PocketSphinx_target_swig_ps = LD_LIBRARY_PATH=$(builddir)/lib.host:$(builddir)/lib.target:$$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd $(srcdir)/.; swig -I/usr/local/share/sphinxbase/swig -javascript -node "-DV8_VERSION=0x032872" -o ps.cpp /usr/local/share/pocketsphinx/swig/pocketsphinx.i

Does that look good to you?

This is the output of ldd, it looks good to me, can you see anything wrong?

:~/workspace/cms/node_modules/pocketsphinx/build/Release (master) $ ldd PocketSphinx.node 
    linux-vdso.so.1 =>  (0x00007ffea30b4000)
    libpocketsphinx.so.3 => /usr/local/lib/libpocketsphinx.so.3 (0x00007fba08da3000)
    libsphinxbase.so.3 => /usr/local/lib/libsphinxbase.so.3 (0x00007fba08b54000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fba0883f000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fba0847a000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fba08174000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fba07f55000)
    /lib64/ld-linux-x86-64.so.2 (0x0000563f9dfed000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fba07d3f000)
nshmyrev commented 8 years ago

Maybe you override it in node somewhere

nshmyrev commented 8 years ago

Instead of using LD_LIBRARY_PATH you can add /usr/local/lib to /etc/ld.so.conf

swestrich commented 8 years ago

Tried that, no difference. I just don't understand, and this is very frustrating. When I try running pocketsphinx_continuous from command line it works. Removed the library and pocketsphinx_continuous stopped working as expected reporting the library was missing.

The only thing I can think of now is that my node server doesn't have read or execution permissions on that path. If this is the case I'm sorry I wasted your time. Do you think that could be the case?

nshmyrev commented 8 years ago

Maybe a permission. You can run under strace to debug.

swestrich commented 8 years ago

Found out that it must be a cloud9 issue. Running the server directly with 'node app.js' works like a charm. Pressing the run in the ide does not. Strange beyond belief, I wish I had not wasted so long on something so trivial. I'll investigate what they are doing on the run command.

swestrich commented 8 years ago

Actually I think it must therefore be a permissions issue between me running it in the console and the ide having less permissions. Just a guess though.

nshmyrev commented 8 years ago

Ok, great

Let me know if you have other issues

swestrich commented 8 years ago

yeah :) thanks for your time.

karuhanga commented 5 years ago

Instead of using LD_LIBRARY_PATH you can add /usr/local/lib to /etc/ld.so.conf

If you take this path, don't forget to reconfigure with sudo ldconfig