Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I've got a problem linking to shared libraries. Specifically this is a nodejs module linking to libmemcached, but I'm guessing the problem is more generic than that. The file it cannot find/open is present, and everything is operating under /usr/local. Running as root doesn't let it see the file either.

I'm running CentOS 5.4

[node-memcache]$ node tests/test.js
Error: cannot open shared object file: No such file
or directory

[node-memcache]$ sudo find /usr -name ""
share|improve this question
up vote 2 down vote accepted

TLDP has a pretty good write up about shared libraries, discussing both how to create them and how to use them.

Your problem, however, is likely because your execution environment does not know where to find libmemcached. The search path is stored in the LD_LIBRARY_PATH environment variable. Try running this command before executing node:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

If that works, then add that to your profile so the variable will be set every time you start a new shell session.

share|improve this answer
perfect, thanks! – user27422 Mar 10 '10 at 2:57

If you keep some of the libraries in /usr/local/lib directory, then you should add it to the /etc/ file and run the ldconfig command. Maybe, running ldconfig is the only thing you need (if is already right).

Using the LD_LIBRARY_PATH environment variable will also work, but is less efficient, as ldconfig cache is not used in this case.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.