Linux : error loading libraries from /usr/local/lib

I have an ARM embedded system running Debian Wheezy. Some of the functionality of our custom written apps is separated into shared library files. We store our shared library files under /usr/local/lib.

The problem I am seeing is that one of our binaries is not starting up correctly as it can’t load one of the shared libs from /usr/local/lib:

/usr/local/bin/daemon_watchdog: error while loading shared libraries: cannot open shared object file: No such file or directory

The file exists in /usr/local/lib. /usr/local/lib should be getting searched for libraries, as we have added an extra file in the directory /etc/ to specifically include /usr/local/lib. I’ve also run ldconfig to refresh the cache.

One clue could be that the file itself depends on other shared libraries. If I run an “ldd″ in /usr/local/lib, it shows that several of the referenced libraries are not being picked up: => not found => not found => not found => not found => not found => not found => not found => /usr/lib/arm-linux-gnueabihf/

(0x402f1000) => /usr/lib/arm-linux-gnueabihf/

However, the files listed as not found are definitely present in /usr/local/lib, e.g.

-rw-r--r-- 1 root root 821784 Nov 22 21:29

Furthermore if I manually set LD_LIBRARY_PATH to /usr/local/lib after the system has booted, I can run our binaries fine.

Can anyone suggest what could be wrong?

1 Solution

Can anyone suggest what could be wrong?

If setting LD_LIBRARY_PATH solves the problem, it’s almost certain that you didn’t add /usr/local/lib to /etc/ correctly.

Which file in /etc/ did you add to?

Maybe you have a typo, or a trailing space, or something.