2

I have a RoR app deployed on DREAMHOST. Here are the versions that am currently running on

  • Ruby: ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
  • Rails: Rails 3.2.3

The error when i try to load home page is as below:

libmysqlclient_r.so.16: cannot open shared object file: No such file or directory - /gems/ruby/1.8/gems/mysql2-0.3.13/lib/mysql2/mysql2.so (LoadError)
/gems/ruby/1.8/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
/gems/ruby/1.8/gems/mysql2-0.3.13/lib/mysql2.rb:8

/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:68:in `require'
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:68:in `require'
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:66:in `each'
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:66:in `require'
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:55:in `each'
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:55:in `require'
/usr/lib/ruby/vendor_ruby/bundler.rb:120:in `require'
/config/application.rb:7 
/config/environment.rb:2:in `require'
/config/environment.rb:2
config.ru:3:in `require'
config.ru:3

I have tried updating the mysql2 gem, uninstalled and re-installed completed bundle install which was a success. I have tried wget -O and added the file. But the error still persists. I have tried to search for answers but have not had much luck.

This is for production environment. Any feedback would be much appreciated.

Holger Just
  • 52,918
  • 14
  • 115
  • 123
LS2
  • 152
  • 3
  • 16

1 Answers1

0

Your issue is not related to gems. libmysqlclient_r complains that mysql2.so cannot be found because it's missing on your machine. You need to deal with it not using bundler, but rather by your system package manager (i.e. for Debian you can use apt-get or aptitude).

First, locate the absolute path of yout libmysqlclient_r.so:

dpkg -S libmysqlclient_r.so.16

now you've got the absolute path, so run:

ldd ABSOLUTE_PATH_TO_YOUR_LIB/libmysqlclient_r.so

ldd lists the dependencies of given library. There will be at least one file missing. Now all you have to do is to install package(s) that are missing.

blelump
  • 3,233
  • 1
  • 16
  • 20
  • Thanks for ur reply.dpkg command returns "no path matching pattern" result. However dpkg -S libmysqlclient_r.so lists 3 paths – LS2 Oct 28 '14 at 16:01
  • Yep, it should return something like `$ dpkg -S libmysqlclient_r.so libmysqlclient-dev: /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so; ...`. First path is that one you're interested in. – blelump Oct 28 '14 at 16:15
  • Thanks, i get linux-vdso.so.1, libz.so.1, .... In dreamhost servers we wont be able to use apt-get. Is there any other way to go about this? – LS2 Oct 29 '14 at 07:08