starting binary – library file not found


Getting an error about not being able to find libraries (file not found), when starting up a binary – such as httpd.


You need to identify the shared libraries required by your binary. Ordinarly we use the ldd command for this and amended LD_LIBRARY_PATH to find the libs – see example below.

You might also want to get the shared libs of a running process – with pldd or need to dig into a lib/binary.


# find dependencies for a binary

% ldd /usr/bin/httpd => /usr/local/lib/ => /usr/lib/ => /usr/lib/

# demo of how ldd walks the values in LD_LIBRARY_PATH


% ldd /usr/bin/httpd => (file not found) => /usr/lib/ => /usr/lib/

# find files installed via a package on Solaris

% grep /var/sadm/install/contents | head -1
/usr/sf/lib/ s none SUNWpng

Another way to see which libraries are being picked up, i.e. if a binary works on one system and not another:

% truss -t'open' -f date
21667: open("/var/ld/ld.config", O_RDONLY) Err#2 ENOENT
21667: open("/usr/lib/", O_RDONLY) = 3
21667: open("/usr/lib/", O_RDONLY) = 3

Getting the dependent shared libraries of a running process (especially where vars might have changed since startup):

% pldd 24832
24832: /usr/bin/httpd

Seeing more detail via the headers within an object file (use objdump on linux):

% elfdump /usr/bin/httpd | grep NEEDED
[0] NEEDED 0x15755
[1] NEEDED 0x15761
[2] NEEDED 0x15771

See configure parameters passed to a binary during compilation (can also be useful for getting a usage out a binary, that does not appear by default or with –h, etc):

Leave a Reply

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