starting binary – library file not found

[problem]

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

[/problem]

[solution]

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.

[/solution]

[example]

# find dependencies for a binary


% ldd /usr/bin/httpd
libpng.so.2 => /usr/local/lib/libpng.so.2
libcrypt_i.so.1 => /usr/lib/libcrypt_i.so.1
libresolv.so.2 => /usr/lib/libresolv.so.2

# demo of how ldd walks the values in LD_LIBRARY_PATH


% unset LD_LIBRARY_PATH

% ldd /usr/bin/httpd
libpng.so.2 => (file not found)
libcrypt_i.so.1 => /usr/lib/libcrypt_i.so.1
libresolv.so.2 => /usr/lib/libresolv.so.2

# find files installed via a package on Solaris


% grep libpng.so.2 /var/sadm/install/contents | head -1
/usr/sf/lib/libpng.so=libpng.so.2 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/libc.so.1", O_RDONLY) = 3
21667: open("/usr/lib/libdl.so.1", 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
/usr/local/lib/libpng.so.2.1.0.5
/usr/lib/libcrypt_i.so.1
/usr/lib/libresolv.so.2
...

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


% elfdump /usr/bin/httpd | grep NEEDED
[0] NEEDED 0x15755 libpng.so.2
[1] NEEDED 0x15761 libcrypt_i.so.1
[2] NEEDED 0x15771 libresolv.so.2
...

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):

[/example]

[reference]

  1. Linux ldd man pages
  2. Linux objdump man pages
  3. Reverse Engineering Linux Binaries

[/reference]

[tags][/tags]

the fade anything technique

[problem]

You want to add something flash to your site.
A color loads, which you then want to change

[/problem]

[solution]

Well cool “Fade Anything Technique”!

Really simple implementation, just copy fade anything>%20fade%20anything%20fat.js%20< and then any divs, etc with an id
of fade-xxx will fade from that color. Many more options, check out these highly recommended articles.

[/solution]

[example]


<head>
...
<script type="text/javascript" src="/fat.js">
</head>
...
<div style="width: 600px; border:1px dashed #23932B; padding: 10px;" id="fade-23932B" class="fade-23932B">
...
</div>

[/example]

[reference]

Check out the article hosted by axentric, written by Adam Michela

It was inspired by 37 signals

[/reference]