install_driver(Sybase) failed: Can't load 'Sybase.so' for module DBD::Sybase

Posted on in System Administration

install_driver(Sybase) failed: Can't load '/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBD/Sybase/Sybase.so' for module DBD::Sybase: libct.so.3: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.0/i386-linux-thread-multi/DynaLoader.pm line 229.
 at (eval 2) line 3
Compilation failed in require at (eval 2) line 3.
Perhaps a required shared library or dll isn't installed where expected
 at t.pl line 9

This is the error I ran into yesterday in one of my Perl scripts. This script has been in production since December 2007 with no changes. For some reason, the script magically started failing. The error obviously indicates a missing library (libct.so.3). In fact, there were two missing libraries:

$ ldd /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBD/Sybase/Sybase.so
    libct.so.3 => not found
    libtds.so.4 => not found
    libdl.so.2 => /lib/libdl.so.2 (0x00af5000)
    libm.so.6 => /lib/tls/libm.so.6 (0x0026f000)
    libc.so.6 => /lib/tls/libc.so.6 (0x0052d000)
    /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x002ff000)

These libraries (libct.so.3 and libtds.so.4) are provided by FreeTDS. Apparently, someone had installed a newer version of the FreeTDS library and the old libraries were lost. The solution was to re-install DBD::Sybase (I also upgraded to the latest version while I was at it):

$ cd DBD-Sybase-1.10
$ SYBASE='/usr' perl Makefile.PL
<snip>
$ make
<snip>
# make install
<snip>
$ ldd /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/DBD/Sybase/Sybase.so
    libct.so.4 => /usr/lib/libct.so.4 (0x0032a000)
    libtds.so.5 => /usr/lib/libtds.so.5 (0x00432000)
    libdl.so.2 => /lib/libdl.so.2 (0x00a9e000)
    libm.so.6 => /lib/tls/libm.so.6 (0x0052f000)
    libc.so.6 => /lib/tls/libc.so.6 (0x00111000)
    /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x009b0000)

Now, I'm using the latest libraries and everything is back to normal.

Slaptijack's Koding Kraken