I got this error starting a ruby application:
/usr/local/rvm/gems/ruby-1.9.3-p547/gems/bundler-1.7.3/lib/bundler/runtime.rb:76:in `require': libdb2.so.1: cannot open shared object file: No such file or directory - /usr/local/rvm/gems/ruby-1.9.3-p547/extensions/x86_64-linux/1.9.1/ibm_db-2.5.11/ibm_db.so (LoadError)
An .so is a Linux library, equivalent to a .dll on Windows or a .dylib on Mac. Note that there are two different libraries mentioned. ibm_db.so is present, while libdb2.so.1 is missing.
You can verify the dependencies using the ldd command:
$ ldd /usr/local/rvm/gems/ruby-1.9.3-p547/extensions/x86_64-linux/1.9.1/ibm_db-2.5.11/ibm_db.so
linux-vdso.so.1 => (0x00007fff93545000)
libruby.so.1.9 => /usr/local/rvm/rubies/ruby-1.9.3-p547/lib/libruby.so.1.9 (0x00007fb8ba5a5000)
libdb2.so.1 => not found
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fb8ba37f000)
librt.so.1 => /lib64/librt.so.1 (0x00007fb8ba177000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fb8b9f72000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fb8b9d3b000)
libm.so.6 => /lib64/libm.so.6 (0x00007fb8b9ab7000)
libc.so.6 => /lib64/libc.so.6 (0x00007fb8b9722000)
/lib64/ld-linux-x86-64.so.2 (0x0000003730400000)
libfreebl3.so => /lib64/libfreebl3.so (0x00007fb8b94ab000)
For me, the issue was caused by a missing IBM Data Server Driver directory. IBM_DB_LIB was pointing to a non-existent directory:
$ set | grep IBM IBM_DB_DIR=/tmp/dsdriver/. IBM_DB_HOME=/tmp/dsdriver/. IBM_DB_INCLUDE=/tmp/dsdriver/./include IBM_DB_LIB=/tmp/dsdriver/./lib
Reinstalling the Data Server Driver restored the libdb2.so.1 and eliminated the error.
(If you run into this issue with different libraries, you will likely need to examine your LD_LIBRARY_PATH environment variable and use the ldconfig command to reload any changes.)
Leave a Reply