cannot open shared object file: No such file or directory

When installing Memcached on a machine I came across the following error when I tried to start it:

memcached: error while loading shared libraries: cannot open shared object file: No such file or directory

The solution for this on Debian/Ubuntu (and probably most other linux distros) is this…

On a 32 bit system:

ln -s /usr/local/lib/ /usr/lib/

On a 64 bit system:

ln -s /usr/local/lib/ /usr/lib64/

After creating the appropriate symlink for your system you should now be able to start memcached as normal:

memcached -d -u memcached_user -m 256 -p 11211

29 Replies to “ cannot open shared object file: No such file or directory”

  1. Ditto on Casey and Tim; this fix worked beautifully on Slackware 14, and.borken tmux is now worken tmux. I’m thrilled the first Google result was actually a fifteen-second fix.

    Thanks so much Nigel. Cheers!

  2. You could also just add the library path to your LD_LIBRARY_PATH environment variable. Assuming you’re using the bash shell, you can edit $HOME/.bashrc and add the following line to it:

    export LD_LIBRARY_PATH

    This way any other libraries that get installed in /usr/local/lib can be used without having to create symlinks every time a new library is installed.

  3. Another way on Red Hat is to create a new .conf file under /etc/ with a single line pointing to /usr/local/lib and then running ldconfig.
    Under /etc, there’s a file that includes *.conf under /etc/ld/so/conf/d/
    This is a nice way to add library lookup paths in a way that reminds you why you have added a specific path (by properly naming the file).

Leave a Reply

Your email address will not be published. Required fields are marked *