Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

all, I installed 'vowpal wabbit' package and also use 'make test' to test it. It shows everything is okay. However, when I input 'vw' in terminal, it has the following errors:

vw: error while loading shared libraries: libvw.so.0: cannot open shared object file: No such file or directory

My system is ubuntu12.04-64bit. Could anyone tell me how to solve this problem ? Thanks

share|improve this question

migrated from stackoverflow.com Apr 11 '13 at 20:26

This question came from our site for professional and enthusiast programmers.

    
Did you build this yourself, or get from a package? Can you rebuild the locate db with /etc/cron.daily/mlocate and then try locate libvw.so.0 – Rich Homolka Apr 11 '13 at 20:55
    
I did it as you told me. I located the 'libvw.so.0'. "/home/tqjustc/Downloads/vowpal_wabbit-7.2/vowpalwabbit/.libs/libvw.so.0" and "/home/tqjustc/Downloads/vowpal_wabbit-7.2/vowpalwabbit/.libs/libvw.so.0.0.0" "/home/tqjustc/Downloads/vowpal_wabbit-7.2/vowpalwabbit/.libs/libvw.so.0.0.0" "/usr/local/lib/libvw.so.0" "/usr/local/lib/libvw.so.0.0.0" – Qiongjie Tian Apr 15 '13 at 8:43
2  
have you tried to set LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib and run it? – Rich Homolka Apr 15 '13 at 17:44
    
@RichHomolka What is this command used for ? thanks – Qiongjie Tian Apr 15 '13 at 17:53
up vote 3 down vote accepted

From the messaging back and forth, it looks like you have the library installed in /usr/local/lib. But your application doesn't know to look there for the library.

You can solve this in a few ways.

  1. You can give special flags when you configure/build your project to tell your binary to check in /usr/local/lib. If you know how to set flags on build, you should set LDFLAGS=-Wl,-rpath,/usr/local/lib. This would make you rebuild though.

  2. The runtime linker looks at an environment variable named LD_LIBRARY_PATH to see what directories to check when looking for shared libraries. In this case, if you type export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib and then run your program, it should work.

  3. If you have multiple programs that need the /usr/local/lib directory, and you feel it is safe to include for everyone, you can set the runtime linker to try /usr/local/lib every time. You can drop a file in /etc/ld.so.conf.d or edit /etc/ld.so.conf to add /usr/local/lib. This would affect every executable on your system, so I consider this one pretty advanced.

In short, you need to tell your program how to find the library. The easiest one for now is to set the LD_LIBRARY_PATH variable with export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .